Blame SOURCES/coreclr-27048-sysctl-deprecation.patch

f2d766
From 3dd725eca0079e2b49821dfeb0ec1cb166cc7414 Mon Sep 17 00:00:00 2001
f2d766
From: Omair Majid <omajid@redhat.com>
f2d766
Date: Fri, 4 Oct 2019 19:29:53 -0400
f2d766
Subject: [PATCH] Handle glibc sys/sysctl.h deprecation
f2d766
f2d766
glibc has deprecated sys/sysctl.h:
f2d766
f2d766
    In file included from /coreclr/src/pal/src/misc/sysinfo.cpp:32:
f2d766
    /usr/include/sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
f2d766
    #warning "The <sys/sysctl.h> header is deprecated and will be removed."
f2d766
     ^
f2d766
    1 error generated.
f2d766
f2d766
Fix that by preferring sysconf and only including sys/sysctl.h if
f2d766
HAVE_SYSCONF is not true. This mirrors the order of the implementation
f2d766
code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF
f2d766
before HAVE_SYSCTL.
f2d766
f2d766
Fixes #27008
f2d766
---
f2d766
 src/pal/src/misc/sysinfo.cpp | 7 +++++--
f2d766
 1 file changed, 5 insertions(+), 2 deletions(-)
f2d766
f2d766
diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp
f2d766
index e1c949e38d53..50ccf3a75e16 100644
f2d766
--- a/src/pal/src/misc/sysinfo.cpp
f2d766
+++ b/src/pal/src/misc/sysinfo.cpp
f2d766
@@ -28,9 +28,12 @@ Revision History:
f2d766
 #define __STDC_FORMAT_MACROS
f2d766
 #include <inttypes.h>
f2d766
 #include <sys/types.h>
f2d766
-#if HAVE_SYSCTL
f2d766
+
f2d766
+#if HAVE_SYSCONF
f2d766
+// <unistd.h> already included above
f2d766
+#elif HAVE_SYSCTL
f2d766
 #include <sys/sysctl.h>
f2d766
-#elif !HAVE_SYSCONF
f2d766
+#else
f2d766
 #error Either sysctl or sysconf is required for GetSystemInfo.
f2d766
 #endif
f2d766