[PATCH] linux: add check for sysctl sycall presence
Samuel Martin
s.martin49 at gmail.com
Sun Nov 23 17:07:00 UTC 2014
# HG changeset patch
# User "Samuel Martin" <s.martin49 at gmail.com>
# Date 1416759425 -3600
# Sun Nov 23 17:17:05 2014 +0100
# Node ID 3a010d195a5a4249da5552c5de7643f898c9e507
# Parent 1be88123e98c8b0e78602eeb3a8c3eb3444c15f3
linux: add check for sysctl sycall presence
And also disable call to the sysctl function when the sysctl syscall
is disabled in the kernel configuration.
This fixes:
http://autobuild.buildroot.org/results/730/730105fc0a89b381b3b29192d07f28ef1f13cbb3/build-end.log
Signed-off-by: Samuel Martin <s.martin49 at gmail.com>
diff -r 1be88123e98c -r 3a010d195a5a auto/os/linux
--- a/auto/os/linux Sat Aug 02 00:30:55 2014 +0200
+++ b/auto/os/linux Sun Nov 23 17:17:05 2014 +0100
@@ -44,6 +44,20 @@
have=NGX_HAVE_POSIX_FADVISE . auto/nohave
fi
+# sysctl syscall
+
+ngx_feature="sysctl_syscall"
+ngx_feature_name="NGX_HAVE_SYSCTL_SYSCALL"
+ngx_feature_run=no
+ngx_feature_run_force_result="$ngx_force_have_sysctl_syscall"
+ngx_feature_incs="#include <sys/sysctl.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="int name[2] = { CTL_KERN, KERN_RTSIGMAX };
+ int old;
+ sysctl(name, 2, &old, sizeof(old), NULL, 0);"
+. auto/feature
+
# epoll, EPOLLET version
ngx_feature="epoll"
diff -r 1be88123e98c -r 3a010d195a5a src/event/modules/ngx_rtsig_module.c
--- a/src/event/modules/ngx_rtsig_module.c Sat Aug 02 00:30:55 2014 +0200
+++ b/src/event/modules/ngx_rtsig_module.c Sun Nov 23 17:17:05 2014 +0100
@@ -621,6 +621,7 @@
if (tested >= rtscf->overflow_test) {
+#if (NGX_HAVE_SYSCTL_SYSCALL)
if (ngx_linux_rtsig_max) {
/*
@@ -668,7 +669,9 @@
}
} else {
-
+#else
+ {
+#endif
/*
* Linux has not KERN_RTSIGMAX since 2.6.6-mm2
* so drain the rt signal queue unconditionally
diff -r 1be88123e98c -r 3a010d195a5a src/os/unix/ngx_linux_config.h
--- a/src/os/unix/ngx_linux_config.h Sat Aug 02 00:30:55 2014 +0200
+++ b/src/os/unix/ngx_linux_config.h Sun Nov 23 17:17:05 2014 +0100
@@ -84,8 +84,10 @@
#if (NGX_HAVE_RTSIG)
#include <poll.h>
+#if (NGX_HAVE_SYSCTL_SYSCALL)
#include <sys/sysctl.h>
#endif
+#endif
#if (NGX_HAVE_EPOLL)
diff -r 1be88123e98c -r 3a010d195a5a src/os/unix/ngx_linux_init.c
--- a/src/os/unix/ngx_linux_init.c Sat Aug 02 00:30:55 2014 +0200
+++ b/src/os/unix/ngx_linux_init.c Sun Nov 23 17:17:05 2014 +0100
@@ -46,7 +46,7 @@
(void) ngx_cpystrn(ngx_linux_kern_osrelease, (u_char *) u.release,
sizeof(ngx_linux_kern_osrelease));
-#if (NGX_HAVE_RTSIG)
+#if (NGX_HAVE_RTSIG) && (NGX_HAVE_SYSCTL_SYSCALL)
{
int name[2];
size_t len;
More information about the nginx-devel
mailing list