coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] build: avoid including sysctl.h on glibc


From: Pádraig Brady
Subject: [PATCH] build: avoid including sysctl.h on glibc
Date: Sun, 2 Feb 2020 15:55:54 +0000

* src/uname.c: Avoid unneeded header with GLIBC,
which has been deprecated since glibc-2.30.
* src/uptime.c: Likewise.
---
 src/uname.c  | 2 +-
 src/uptime.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/uname.c b/src/uname.c
index 63758c244..4065bf29e 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -27,7 +27,7 @@
 # include <sys/systeminfo.h>
 #endif
 
-#if HAVE_SYS_SYSCTL_H
+#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__
 # if HAVE_SYS_PARAM_H
 #  include <sys/param.h> /* needed for OpenBSD 3.0 */
 # endif
diff --git a/src/uptime.c b/src/uptime.c
index 9749ca81a..a42e702b5 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -22,7 +22,7 @@
 #include <sys/types.h>
 #include "system.h"
 
-#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
+#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H && ! defined __GLIBC__
 # include <sys/sysctl.h>
 #endif
 
@@ -80,7 +80,8 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
     }
 #endif /* HAVE_PROC_UPTIME */
 
-#if HAVE_SYSCTL && defined CTL_KERN && defined KERN_BOOTTIME
+#if HAVE_SYSCTL && ! defined __GLIBC__ \
+    && defined CTL_KERN && defined KERN_BOOTTIME
   {
     /* FreeBSD specific: fetch sysctl "kern.boottime".  */
     static int request[2] = { CTL_KERN, KERN_BOOTTIME };
-- 
2.24.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]