summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2019-10-16 05:25:29 -0400
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>2019-12-10 12:21:09 +0900
commit94e458e93da3d5867938ea9a80489f5a0a66d7f0 (patch)
tree378d980ebdc8bc67ea01c7f2c5f24d481eafc04e /src
parent762d3bd09db51d983c77388657493e679637e940 (diff)
downloadcoreclr-94e458e93da3d5867938ea9a80489f5a0a66d7f0.tar.gz
coreclr-94e458e93da3d5867938ea9a80489f5a0a66d7f0.tar.bz2
coreclr-94e458e93da3d5867938ea9a80489f5a0a66d7f0.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 e3d001b544..56c72878be 100644
--- a/src/pal/src/misc/sysinfo.cpp
+++ b/src/pal/src/misc/sysinfo.cpp
@@ -26,9 +26,12 @@ Revision History:
#include <errno.h>
#include <unistd.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