[tor-commits] [tor/maint-0.4.1] build: The <sys/sysctl.h> is now deprecated on Linux

nickm at torproject.org nickm at torproject.org
Tue Sep 17 23:00:22 UTC 2019


commit 409df19b5a0053175f05851086e6ef35c5bce2c0
Author: David Goulet <dgoulet at torproject.org>
Date:   Mon Sep 9 11:55:33 2019 -0400

    build: The <sys/sysctl.h> is now deprecated on Linux
    
    Closes #31673
---
 changes/ticket31673       | 3 +++
 src/lib/meminfo/meminfo.c | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/changes/ticket31673 b/changes/ticket31673
new file mode 100644
index 000000000..3b2bb4a46
--- /dev/null
+++ b/changes/ticket31673
@@ -0,0 +1,3 @@
+  o New system requirements (build system):
+    - Do not include the deprecated <sys/sysctl.h> on Linux or Windows system.
+      Closes 31673;
diff --git a/src/lib/meminfo/meminfo.c b/src/lib/meminfo/meminfo.c
index f23318889..f4fa45167 100644
--- a/src/lib/meminfo/meminfo.c
+++ b/src/lib/meminfo/meminfo.c
@@ -18,9 +18,6 @@
 #include "lib/log/log.h"
 #include "lib/malloc/malloc.h"
 
-#ifdef HAVE_SYS_SYSCTL_H
-#include <sys/sysctl.h>
-#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
@@ -36,6 +33,10 @@
 #endif
 #include <string.h>
 
+#if defined(HAVE_SYS_SYSCTL_H) && !defined(_WIN32) && !defined(__linux__)
+#include <sys/sysctl.h>
+#endif
+
 DISABLE_GCC_WARNING(aggregate-return)
 /** Call the platform malloc info function, and dump the results to the log at
  * level <b>severity</b>.  If no such function exists, do nothing. */





More information about the tor-commits mailing list