diff options
author | Omair Majid <omajid@redhat.com> | 2019-10-16 05:25:29 -0400 |
---|---|---|
committer | Dongkyun Son <dongkyun.s@samsung.com> | 2019-12-13 10:26:27 +0900 |
commit | 41952000fcd0872a4e2e9ae3e28e5333a5bf60ca (patch) | |
tree | a7dc92ca8d1d72597dd73fa85fae52f82ea82a54 | |
parent | 0f28fa8e4171b42917d3bc3dcf7b03c5531e7db2 (diff) | |
download | diagnostics-sandbox/dkson95/5.5.tar.gz diagnostics-sandbox/dkson95/5.5.tar.bz2 diagnostics-sandbox/dkson95/5.5.zip |
Handle glibc sys/sysctl.h deprecation (#27048)sandbox/dkson95/5.5
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
-rw-r--r-- | src/pal/src/misc/sysinfo.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp index dd23c9cea..45b6b3bdb 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 |