summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2019-10-16 05:25:29 -0400
committerGleb Balykov <g.balykov@samsung.com>2020-03-25 15:29:41 +0300
commit643ad2bf32f577f148dccbf59f680884ceb67deb (patch)
tree4b86ce3de67cef568984b01e0cbae4600e49e3bd /src
parent273a346e7bc2969e8176a6c86bb73b025907cd6a (diff)
downloadcoreclr-643ad2bf32f577f148dccbf59f680884ceb67deb.tar.gz
coreclr-643ad2bf32f577f148dccbf59f680884ceb67deb.tar.bz2
coreclr-643ad2bf32f577f148dccbf59f680884ceb67deb.zip
Handle glibc sys/sysctl.h deprecation (#27048)
glibc has deprecated sys/sysctl.h: In file included from /coreclr/src/pal/src/misc/sysinfo.cpp:32: /usr/include/sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings] #warning "The <sys/sysctl.h> header is deprecated and will be removed." ^ 1 error generated. Fix that by preferring sysconf and only including sys/sysctl.h if HAVE_SYSCONF is not true. This mirrors the order of the implementation code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF before HAVE_SYSCTL. Fixes #27008
Diffstat (limited to 'src')
-rw-r--r--src/pal/src/misc/sysinfo.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp
index 52e8ec065d..b8a6a70333 100644
--- a/src/pal/src/misc/sysinfo.cpp
+++ b/src/pal/src/misc/sysinfo.cpp
@@ -28,9 +28,12 @@ Revision History:
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <sys/types.h>
-#if HAVE_SYSCTL
+
+#if HAVE_SYSCONF
+// <unistd.h> already included above
+#elif HAVE_SYSCTL
#include <sys/sysctl.h>
-#elif !HAVE_SYSCONF
+#else
#error Either sysctl or sysconf is required for GetSystemInfo.
#endif