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

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