]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Avoid warning about sys/sysctl.h on glibc-2.30.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 20 Aug 2019 07:10:53 +0000 (09:10 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 Aug 2021 18:31:45 +0000 (20:31 +0200)
From glibc-2.30 NEWS:

The Linux-specific <sys/sysctl.h> header and the sysctl function have
been deprecated and will be removed from a future version of glibc.

Compilation against the glibc-2.30 headers results in the following warning:

In file included from ipc.c:10:
/usr/include/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]

On NetBSD and FreeBSD, however, we still need to include the header
to get the declaration of sysctlbyname(3).

This patch changes ipc.c to include sys/sysctl.h only if __FreeBSD__ or
__NetBSD__ is defined.  Also remove the pointless check for __APPLE__.

ipc.c

diff --git a/ipc.c b/ipc.c
index 9488224a1d4a622860adc957b27977e2bcbfc7e2..a9d7351ce6ddf1a416e2419440857cb3cee70eb9 100644 (file)
--- a/ipc.c
+++ b/ipc.c
@@ -11,7 +11,6 @@
 #include "ipc.h"
 #include <sys/types.h>
 #include <sys/param.h>
 #include "ipc.h"
 #include <sys/types.h>
 #include <sys/param.h>
-#include <sys/sysctl.h>
 
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
 #include <sys/ipc.h>
 #include <sys/shm.h>
@@ -177,9 +176,8 @@ int shm_detach(void *addr)
 }
 
 # if defined __FreeBSD__ || defined __NetBSD__
 }
 
 # if defined __FreeBSD__ || defined __NetBSD__
+#include <sys/sysctl.h>
 #      define SYSCTL_SHMMAX_VARIABLE "kern.ipc.shmmax"
 #      define SYSCTL_SHMMAX_VARIABLE "kern.ipc.shmmax"
-# elif defined __APPLE__
-#      define SYSCTL_SHMMAX_VARIABLE "kern.sysv.shmmax"
 # else
 #      undef SYSCTL_SHMMAX_VARIABLE
 # endif
 # else
 #      undef SYSCTL_SHMMAX_VARIABLE
 # endif