Handle glibc sys/sysctl.h deprecation (#27048)
authorOmair Majid <omajid@redhat.com>
Wed, 16 Oct 2019 09:25:29 +0000 (05:25 -0400)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Tue, 10 Dec 2019 03:21:09 +0000 (12:21 +0900)
commit94e458e93da3d5867938ea9a80489f5a0a66d7f0
tree378d980ebdc8bc67ea01c7f2c5f24d481eafc04e
parent762d3bd09db51d983c77388657493e679637e940
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
src/pal/src/misc/sysinfo.cpp