After some bit of research, I couldn't find a platform (besides Linux
< 2.6) where SIGUSR2 is "reserved", so possibly something like the
attached patch would be acceptable.

The patch adds --enable-graceful-stop-sigusr2 to configure(.in) which
default to "yes" (for trunk, but would default to "no" for a potential
backport to 2.4.x), and which anyway is forced to "no" for platforms
we know it won't work (linux < 2.6 for now, please add yours...).

May I commit this (before unblocking graceful stop in ONE_PROCESS mode)?

Thanks,
Yann.
Index: configure.in
===================================================================
--- configure.in	(revision 1853992)
+++ configure.in	(working copy)
@@ -915,6 +915,21 @@ AC_ARG_ENABLE(bsd-makefiles,APACHE_HELP_STRING(--e
   FORCE_BSD_MAKEFILE="auto"
 ])
 
+# For httpd 2.5 and later, SIGUSR2 is used by default if it works (opt-out per platform below)
+AC_ARG_ENABLE(graceful-stop-sigusr2,APACHE_HELP_STRING(--enable-graceful-stop-sigusr2,Use SIGUSR2 as the signal to gracefully stop httpd (default is yes, no implies legacy SIGWINCH)))
+case $host in
+*-linux-[[01]].* | *-linux-2.[[012345]]* )
+    if test "$enable_graceful_stop_sigusr2" = "yes"; then
+        AC_ERROR([--enable-graceful-stop-sigusr2 will not work for Linux prior to 2.6])
+    fi
+    enable_graceful_stop_sigusr2=no
+    ;;
+esac
+# For httpd 2.4 and earlier, this test should be =yes (opt-in)
+if test "$enable_graceful_stop_sigusr2" != "no"; then
+    APR_ADDTO(CPPFLAGS, -DAP_USE_GRACEFUL_STOP_SIGUSR2)
+fi
+
 AC_ARG_WITH([test-suite],
     APACHE_HELP_STRING([--with-test-suite=PATH], [enable in-tree 'make check' with the given Apache::Test suite location]),
     [
Index: include/mpm_common.h
===================================================================
--- include/mpm_common.h	(revision 1853992)
+++ include/mpm_common.h	(working copy)
@@ -72,7 +72,21 @@ extern "C" {
 /* Signal used to gracefully restart (as a quoted string) */
 #define AP_SIG_GRACEFUL_STRING "SIGUSR1"
 
+/* If configured, use SIGUSR2 for graceful stop */
+#ifdef AP_USE_GRACEFUL_STOP_SIGUSR2
+
 /* Signal used to gracefully stop */
+#define AP_SIG_GRACEFUL_STOP SIGUSR2
+
+/* Signal used to gracefully stop (without SIG prefix) */
+#define AP_SIG_GRACEFUL_STOP_SHORT USR2
+
+/* Signal used to gracefully stop (as a quoted string) */
+#define AP_SIG_GRACEFUL_STOP_STRING "SIGUSR2"
+
+#else /* Fallback to SIGWINCH (legacy) */
+
+/* Signal used to gracefully stop */
 #define AP_SIG_GRACEFUL_STOP SIGWINCH
 
 /* Signal used to gracefully stop (without SIG prefix) */
@@ -80,6 +94,7 @@ extern "C" {
 
 /* Signal used to gracefully stop (as a quoted string) */
 #define AP_SIG_GRACEFUL_STOP_STRING "SIGWINCH"
+#endif
 
 /**
  * Callback function used for ap_reclaim_child_processes() and

Reply via email to