From: Omair Majid Date: Wed, 16 Oct 2019 09:25:29 +0000 (-0400) Subject: Handle glibc sys/sysctl.h deprecation (dotnet/coreclr#27048) X-Git-Tag: submit/tizen/20210909.063632~11030^2~373 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f26826abc2ad74f07912d6dbe4cb6a627f1f6120;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Handle glibc sys/sysctl.h deprecation (dotnet/coreclr#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 header is deprecated and will be removed." [-Werror,-W#warnings] #warning "The 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 dotnet/coreclr#27008 Commit migrated from https://github.com/dotnet/coreclr/commit/6ce179a17061abbbe9f904f878943a28c8041a62 --- diff --git a/src/coreclr/src/pal/src/misc/sysinfo.cpp b/src/coreclr/src/pal/src/misc/sysinfo.cpp index e1c949e..50ccf3a 100644 --- a/src/coreclr/src/pal/src/misc/sysinfo.cpp +++ b/src/coreclr/src/pal/src/misc/sysinfo.cpp @@ -28,9 +28,12 @@ Revision History: #define __STDC_FORMAT_MACROS #include #include -#if HAVE_SYSCTL + +#if HAVE_SYSCONF +// already included above +#elif HAVE_SYSCTL #include -#elif !HAVE_SYSCONF +#else #error Either sysctl or sysconf is required for GetSystemInfo. #endif