From: Pádraig Brady
Date: Sun, 2 Feb 2020 15:24:02 +0000 (+0000)
Subject: sysctl.h: avoid including on glibc
X-Git-Tag: v1.0~4283
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7a2f755a776e32bce67447c55f58f5b83c6d4fc4;p=gnulib.git
sysctl.h: avoid including on glibc
* lib/nproc.c: Avoid including deprecated and unneeded header on GLIBC.
glibc deprecated this header since v2.30.
* lib/physmem.c: Likewise.
---
diff --git a/ChangeLog b/ChangeLog
index 55cd67f6fb..1e5f94d3c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-02 Pádraig Brady
+
+ sysctl.h: avoid including on glibc
+ * lib/nproc.c: Avoid including deprecated and unneeded header on GLIBC.
+ * lib/physmem.c: Likewise.
+
2020-02-02 Bruno Haible
list, set, oset, map, omap: Avoid imperative voice in documentation.
diff --git a/lib/nproc.c b/lib/nproc.c
index da510214a7..4fc8747e1b 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -46,7 +46,7 @@
# include
#endif
-#if HAVE_SYS_SYSCTL_H
+#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__
# include
#endif
@@ -306,7 +306,7 @@ num_processors_ignoring_omp (enum nproc_query query)
/* Finally, as fallback, use the APIs that don't distinguish between
NPROC_CURRENT and NPROC_ALL. */
-#if HAVE_SYSCTL && defined HW_NCPU
+#if HAVE_SYSCTL && ! defined __GLIBC__ && defined HW_NCPU
{ /* This works on Mac OS X, FreeBSD, NetBSD, OpenBSD. */
int nprocs;
size_t len = sizeof (nprocs);
diff --git a/lib/physmem.c b/lib/physmem.c
index b8ef16e005..76813a43d7 100644
--- a/lib/physmem.c
+++ b/lib/physmem.c
@@ -50,7 +50,7 @@
# include
#endif
-#if HAVE_SYS_SYSCTL_H
+#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__
# include
#endif
@@ -149,7 +149,7 @@ physmem_total (void)
}
#endif
-#if HAVE_SYSCTL && defined HW_PHYSMEM
+#if HAVE_SYSCTL && ! defined __GLIBC__ && defined HW_PHYSMEM
{ /* This works on *bsd and darwin. */
unsigned int physmem;
size_t len = sizeof physmem;
@@ -263,7 +263,7 @@ physmem_available (void)
}
#endif
-#if HAVE_SYSCTL && defined HW_USERMEM
+#if HAVE_SYSCTL && ! defined __GLIBC__ && defined HW_USERMEM
{ /* This works on *bsd and darwin. */
unsigned int usermem;
size_t len = sizeof usermem;