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

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