]> granicus.if.org Git - apache/commitdiff
Switch back to SIGUSR1 for graceful restarts on all platforms that
authorJustin Erenkrantz <jerenkrantz@apache.org>
Tue, 18 Sep 2001 22:13:59 +0000 (22:13 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Tue, 18 Sep 2001 22:13:59 +0000 (22:13 +0000)
support it.  This defines a symbol called AP_SIG_GRACEFUL in
ap_config_auto.h which will have the appropriate signal value.  All
direct references to SIGWINCH have been replaced with AP_SIG_GRACEFUL.

On Linux 2.0, use SIGWINCH instead since SIGUSR1 is used by glibc
2.0's user-space threading library to control threads.  All later
versions of Linux/glibc don't have this problem.  (Not to mention the
security holes in older Linux versions which make it unsuitable for
use as a web server.)  If your platform doesn't have SIGUSR1, use the
appropriate mojo in configure to define what your graceful restart
signal should be.

In theory, a configure switch could be added to allow the admin to
specify the appropriate signal that should be used.  This is left
as an exercise to the reader for now.

The docs need to be updated.  Since the signal is now configurable,
just saying SIGUSR1 for graceful restart isn't completely true.  Also,
the apachectl functionality needs to be moved into httpd - this is
what Win32 does and it makes us consistent across platforms.

Roy issued a veto against use of SIGWINCH by default, so this should
resolve that veto.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91076 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
CHANGES
configure.in
modules/generators/mod_cgid.c
modules/mappers/mod_so.c
server/log.c
server/mpm/beos/beos.c
server/mpm/experimental/perchild/perchild.c
server/mpm/perchild/perchild.c
server/mpm/prefork/prefork.c
server/mpm/threaded/threaded.c
server/mpm/worker/worker.c
server/mpm_common.c
server/protocol.c
support/apachectl.in

diff --git a/CHANGES b/CHANGES
index 2099a901977a397b2c0ce91a6743cc39e7fa026b..e8e94c84ea5cd9d7003b5c74ac9c82c5de985794 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.26-dev
 
+  *) Switch back to SIGUSR1 for graceful restarts on all platforms that
+     support it.  [Justin Erenkrantz]
+
   *) Cleanup the worker MPM.  We no longer re-use transaction
      pools.  This incurs less overhead than shuffling the pools
      around so that they can be re-used.  Remove one of the
index 9cf9627597ceb76347448c9e5f554e332028f98d..6c5a809a1301c32a758ea4c82fa3d412d9749912 100644 (file)
@@ -142,6 +142,8 @@ esac
 APACHE_SUBST(SHLTCFLAGS)
 APACHE_SUBST(LTCFLAGS)
 
+AP_SIG_GRACEFUL=SIGUSR1
+
 case $host in
   *-apple-aux3*)
       APR_SETVAR(APACHE_MPM, [prefork])
@@ -157,7 +159,11 @@ case $host in
       ;;
   *-linux-*)
       case `uname -r` in
-        2.[[2-9]]* ) APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
+        2.0* ) 
+            AP_SIG_GRACEFUL=SIGWINCH
+            ;;
+        2.[[2-9]]* ) 
+            APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
             ;;
         * )
             ;;
@@ -347,6 +353,10 @@ if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
               [This platform doesn't suffer from the thundering herd problem])
 fi
 
+AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL, $AP_SIG_GRACEFUL, [Signal used to gracefully restart])
+AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL_STRING, "$AP_SIG_GRACEFUL", [Signal used to gracefully restart (as a quoted string)])
+AC_SUBST(AP_SIG_GRACEFUL)
+
 dnl check for endianness
 if test "$cross_compiling" = "no"; then
   AC_C_BIGENDIAN
index 1ecaa44e02b7b8984c935b759968cb860e8736a7..46aa2f0f5267aae8abcb65dd38c16b17c5dd88a4 100644 (file)
@@ -238,10 +238,10 @@ static void cgid_maint(int reason, void *data, apr_wait_t status)
         case APR_OC_REASON_LOST:
             /* it would be better to restart just the cgid child
              * process but for now we'll gracefully restart the entire 
-             * server by sending SIGWINCH to ourself, the httpd parent
-             * process
+             * server by sending AP_SIG_GRACEFUL to ourself, the httpd 
+             * parent process
              */
-            kill(getpid(), SIGWINCH);
+            kill(getpid(), AP_SIG_GRACEFUL);
             break;
         case APR_OC_REASON_RESTART:
             apr_proc_other_child_unregister(data);
index ba9466f6225a55f9dc0d834a69fc54d62b1459a6..38c58013b9a64d7afb5014f2c38e21bc78230242 100644 (file)
@@ -59,8 +59,8 @@
 /* 
  * This module is used to load Apache modules at runtime. This means that the
  * server functionality can be extended without recompiling and even without
- * taking the server down at all. Only a HUP or WINCH signal needs to be send
- * to the server to reload the dynamically loaded modules.
+ * taking the server down at all. Only a HUP or AP_SIG_GRACEFUL signal 
+ * needs to be sent to the server to reload the dynamically loaded modules.
  *
  * To use, you'll first need to build your module as a shared library, then
  * update your configuration (httpd.conf) to get the Apache core to load the
@@ -98,9 +98,9 @@
  * directive to get these log messages).
  *
  * If you edit the LoadModule directives while the server is live you can get
- * Apache to re-load the modules by sending it a HUP or WINCH signal as normal.
- * You can use this to dynamically change the capability of your server
- * without bringing it down.
+ * Apache to re-load the modules by sending it a HUP or AP_SIG_GRACEFUL 
+ * signal as normal.  You can use this to dynamically change the capability 
+ * of your server without bringing it down.
  *
  * Because currently there is only limited builtin support in the Configure
  * script for creating the shared library files (`.so'), please consult your
index 0ef006d70724fe221e5d1ea463623a5d07c1837b..3991e68661ae9f0471e18632635c73aeddd18b02 100644 (file)
@@ -527,7 +527,7 @@ AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname)
     mypid = getpid();
     if (mypid != saved_pid 
          && apr_stat(&finfo, fname, APR_FINFO_MTIME, p) == APR_SUCCESS) {
-      /* WINCH and HUP call this on each restart.
+      /* AP_SIG_GRACEFUL and HUP call this on each restart.
        * Only warn on first time through for this pid.
        *
        * XXX: Could just write first time through too, although
index e539c490e1e38e1a969b2dd9e079c38965a2e106..2ecbe6d5cb398f23de8fd3387434d4c8dacd44cc 100644 (file)
@@ -119,8 +119,8 @@ static void check_restart(void *data);
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxClients changes across SIGWINCH restarts.  We use this
- * value to optimize routines that have to scan the entire scoreboard.
+ * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We use 
+ * this value to optimize routines that have to scan the entire scoreboard.
  */
 int ap_max_child_assigned = -1;
 int ap_max_threads_limit = -1;
@@ -226,7 +226,7 @@ static void sig_term(int sig)
 
 static void restart(int sig)
 {
-    ap_start_restart(sig == SIGWINCH);
+    ap_start_restart(sig == AP_SIG_GRACEFUL);
 }
 
 static void tell_workers_to_exit(void)
@@ -270,14 +270,15 @@ static void set_signals(void)
     if (sigaction(SIGPIPE, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
 
-    /* we want to ignore HUPs and WINCH while we're busy processing one */
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+     * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
-    sigaddset(&sa.sa_mask, SIGWINCH);
+    sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
-    if (sigaction(SIGWINCH, &sa, NULL) < 0)
-           ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
+    if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+           ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 }
 
 /*****************************************************************
@@ -810,9 +811,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     /* If we're doing a graceful_restart then we're going to see a lot
      * of threads exiting immediately when we get into the main loop
-     * below (because we just sent them SIGWINCH).  This happens pretty
-     * rapidly... and for each one that exits we'll start a new one until
-     * we reach at least threads_min_free.  But we may be permitted to
+     * below (because we just sent them AP_SIG_GRACEFUL).  This happens 
+     * pretty rapidly... and for each one that exits we'll start a new one 
+     * until we reach at least threads_min_free.  But we may be permitted to
      * start more than that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
@@ -920,7 +921,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     if (is_graceful) {
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
-                   "SIGWINCH received.  Doing graceful restart");
+                   AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
     }
     else {
         /* Kill 'em all.  Since the child acts the same on the parents SIGTERM 
index aeb70a5b0994905567538cc17c779ba4e803f83f..6c1e1d6b975f3edfb8fa48f03b01c28a877f3cbc 100644 (file)
@@ -151,8 +151,9 @@ struct ap_ctable    ap_child_table[HARD_SERVER_LIMIT];
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with NumServers changes across SIGWINCH restarts.  We use this
- * value to optimize routines that have to scan the entire child table.
+ * to deal with NumServers changes across AP_SIG_GRACEFUL restarts.  We 
+ * use this value to optimize routines that have to scan the entire child 
+ * table.
  *
  * XXX - It might not be worth keeping this code in. There aren't very
  * many child processes in this MPM.
@@ -352,7 +353,7 @@ static void sig_term(int sig)
 static void restart(int sig)
 {
 #ifndef WIN32
-    ap_start_restart(sig == SIGWINCH);
+    ap_start_restart(sig == AP_SIG_GRACEFUL);
 #else
     ap_start_restart(1);
 #endif
@@ -416,14 +417,15 @@ static void set_signals(void)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
 #endif
 
-    /* we want to ignore HUPs and WINCH while we're busy processing one */
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+     * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
-    sigaddset(&sa.sa_mask, SIGWINCH);
+    sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
-    if (sigaction(SIGWINCH, &sa, NULL) < 0)
-       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
+    if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 #else
     if (!one_process) {
        apr_signal(SIGSEGV, sig_coredump);
@@ -451,9 +453,9 @@ static void set_signals(void)
 #ifdef SIGHUP
     apr_signal(SIGHUP, restart);
 #endif /* SIGHUP */
-#ifdef SIGWINCH
-    apr_signal(SIGWINCH, restart);
-#endif /* SIGWINCH */
+#ifdef AP_SIG_GRACEFUL
+    apr_signal(AP_SIG_GRACEFUL, restart);
+#endif /* AP_SIG_GRACEFUL */
 #ifdef SIGPIPE
     apr_signal(SIGPIPE, SIG_IGN);
 #endif /* SIGPIPE */
@@ -1219,9 +1221,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     /* If we're doing a graceful_restart then we're going to see a lot
      * of children exiting immediately when we get into the main loop
-     * below (because we just sent them SIGWINCH).  This happens pretty
-     * rapidly... and for each one that exits we'll start a new one until
-     * we reach at least daemons_min_free.  But we may be permitted to
+     * below (because we just sent them AP_SIG_GRACEFUL).  This happens 
+     * pretty rapidly... and for each one that exits we'll start a new one 
+     * until we reach at least daemons_min_free.  But we may be permitted to
      * start more than that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
@@ -1284,7 +1286,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         char char_of_death = '!';
 
        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
-                   "SIGWINCH received.  Doing graceful restart");
+           AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
 
        /* This is mostly for debugging... so that we know what is still
          * gracefully dealing with existing request.
index aeb70a5b0994905567538cc17c779ba4e803f83f..6c1e1d6b975f3edfb8fa48f03b01c28a877f3cbc 100644 (file)
@@ -151,8 +151,9 @@ struct ap_ctable    ap_child_table[HARD_SERVER_LIMIT];
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with NumServers changes across SIGWINCH restarts.  We use this
- * value to optimize routines that have to scan the entire child table.
+ * to deal with NumServers changes across AP_SIG_GRACEFUL restarts.  We 
+ * use this value to optimize routines that have to scan the entire child 
+ * table.
  *
  * XXX - It might not be worth keeping this code in. There aren't very
  * many child processes in this MPM.
@@ -352,7 +353,7 @@ static void sig_term(int sig)
 static void restart(int sig)
 {
 #ifndef WIN32
-    ap_start_restart(sig == SIGWINCH);
+    ap_start_restart(sig == AP_SIG_GRACEFUL);
 #else
     ap_start_restart(1);
 #endif
@@ -416,14 +417,15 @@ static void set_signals(void)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
 #endif
 
-    /* we want to ignore HUPs and WINCH while we're busy processing one */
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+     * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
-    sigaddset(&sa.sa_mask, SIGWINCH);
+    sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
-    if (sigaction(SIGWINCH, &sa, NULL) < 0)
-       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
+    if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 #else
     if (!one_process) {
        apr_signal(SIGSEGV, sig_coredump);
@@ -451,9 +453,9 @@ static void set_signals(void)
 #ifdef SIGHUP
     apr_signal(SIGHUP, restart);
 #endif /* SIGHUP */
-#ifdef SIGWINCH
-    apr_signal(SIGWINCH, restart);
-#endif /* SIGWINCH */
+#ifdef AP_SIG_GRACEFUL
+    apr_signal(AP_SIG_GRACEFUL, restart);
+#endif /* AP_SIG_GRACEFUL */
 #ifdef SIGPIPE
     apr_signal(SIGPIPE, SIG_IGN);
 #endif /* SIGPIPE */
@@ -1219,9 +1221,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     /* If we're doing a graceful_restart then we're going to see a lot
      * of children exiting immediately when we get into the main loop
-     * below (because we just sent them SIGWINCH).  This happens pretty
-     * rapidly... and for each one that exits we'll start a new one until
-     * we reach at least daemons_min_free.  But we may be permitted to
+     * below (because we just sent them AP_SIG_GRACEFUL).  This happens 
+     * pretty rapidly... and for each one that exits we'll start a new one 
+     * until we reach at least daemons_min_free.  But we may be permitted to
      * start more than that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
@@ -1284,7 +1286,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         char char_of_death = '!';
 
        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
-                   "SIGWINCH received.  Doing graceful restart");
+           AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
 
        /* This is mostly for debugging... so that we know what is still
          * gracefully dealing with existing request.
index c10c51a1fc2319d15cf5ffb12450db29c59e52cd..fe98d51f82919bbdf6f2b29e27470fa8cb1f5cfd 100644 (file)
@@ -144,8 +144,8 @@ static ap_pod_t *pod;
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxClients changes across SIGWINCH restarts.  We use this
- * value to optimize routines that have to scan the entire scoreboard.
+ * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We 
+ * use this value to optimize routines that have to scan the entire scoreboard.
  */
 int ap_max_daemons_limit = -1;
 server_rec *ap_server_conf;
@@ -435,7 +435,7 @@ static void sig_term(int sig)
     shutdown_pending = 1;
 }
 
-/* restart() is the signal handler for SIGHUP and SIGWINCH
+/* restart() is the signal handler for SIGHUP and AP_SIG_GRACEFUL
  * in the parent process, unless running in ONE_PROCESS mode
  */
 static void restart(int sig)
@@ -445,7 +445,7 @@ static void restart(int sig)
        return;
     }
     restart_pending = 1;
-    if ((is_graceful = (sig == SIGWINCH))) {
+    if ((is_graceful = (sig == AP_SIG_GRACEFUL))) {
         apr_pool_cleanup_kill(pconf, NULL, ap_cleanup_scoreboard);
     }
 }
@@ -508,14 +508,15 @@ static void set_signals(void)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
 #endif
 
-    /* we want to ignore HUPs and WINCH while we're busy processing one */
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+     * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
-    sigaddset(&sa.sa_mask, SIGWINCH);
+    sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
-    if (sigaction(SIGWINCH, &sa, NULL) < 0)
-        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
+    if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 #else
     if (!one_process) {
        apr_signal(SIGSEGV, sig_coredump);
@@ -543,9 +544,9 @@ static void set_signals(void)
 #ifdef SIGHUP
     apr_signal(SIGHUP, restart);
 #endif /* SIGHUP */
-#ifdef SIGWINCH
-    apr_signal(SIGWINCH, restart);
-#endif /* SIGWINCH */
+#ifdef AP_SIG_GRACEFUL
+    apr_signal(AP_SIG_GRACEFUL, restart);
+#endif /* AP_SIG_GRACEFUL */
 #ifdef SIGPIPE
     apr_signal(SIGPIPE, SIG_IGN);
 #endif /* SIGPIPE */
@@ -856,7 +857,7 @@ static int make_child(server_rec *s, int slot)
 
     if (one_process) {
        apr_signal(SIGHUP, just_die);
-        /* Don't catch SIGWINCH in ONE_PROCESS mode :) */
+        /* Don't catch AP_SIG_GRACEFUL in ONE_PROCESS mode :) */
        apr_signal(SIGINT, just_die);
 #ifdef SIGQUIT
        apr_signal(SIGQUIT, SIG_DFL);
@@ -909,10 +910,10 @@ static int make_child(server_rec *s, int slot)
         */
        apr_signal(SIGHUP, just_die);
        apr_signal(SIGTERM, just_die);
-        /* The child process doesn't do anything for SIGWINCH.  Instead, the
-         * pod is used for signalling graceful restart.
+        /* The child process doesn't do anything for AP_SIG_GRACEFUL.  
+         * Instead, the pod is used for signalling graceful restart.
          */
-        apr_signal(SIGWINCH, SIG_IGN);
+        apr_signal(AP_SIG_GRACEFUL, SIG_IGN);
        child_main(slot);
     }
 
@@ -1141,7 +1142,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     /* If we're doing a graceful_restart then we're going to see a lot
        * of children exiting immediately when we get into the main loop
-       * below (because we just sent them SIGWINCH).  This happens pretty
+       * below (because we just sent them AP_SIG_GRACEFUL).  This happens pretty
        * rapidly... and for each one that exits we'll start a new one until
        * we reach at least daemons_min_free.  But we may be permitted to
        * start more than that, so we'll just keep track of how many we're
index b55923f111c4a394126c76de241af96a21ec3168..5a14e1ce7889434288ac6d24e5f2dc23e215e950 100644 (file)
@@ -134,8 +134,8 @@ typedef struct {
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxClients changes across SIGWINCH restarts.  We use this
- * value to optimize routines that have to scan the entire scoreboard.
+ * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We use 
+ * this value to optimize routines that have to scan the entire scoreboard.
  */
 int ap_max_daemons_limit = -1;
 
@@ -332,7 +332,7 @@ static void sig_term(int sig)
 
 static void restart(int sig)
 {
-    ap_start_restart(sig == SIGWINCH);
+    ap_start_restart(sig == AP_SIG_GRACEFUL);
 }
 
 static void set_signals(void)
@@ -393,14 +393,15 @@ static void set_signals(void)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
 #endif
 
-    /* we want to ignore HUPs and WINCH while we're busy processing one */
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+     * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
-    sigaddset(&sa.sa_mask, SIGWINCH);
+    sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
-    if (sigaction(SIGWINCH, &sa, NULL) < 0)
-       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
+    if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 #else
     if (!one_process) {
        apr_signal(SIGSEGV, sig_coredump);
@@ -428,9 +429,9 @@ static void set_signals(void)
 #ifdef SIGHUP
     apr_signal(SIGHUP, restart);
 #endif /* SIGHUP */
-#ifdef SIGWINCH
-    apr_signal(SIGWINCH, restart);
-#endif /* SIGWINCH */
+#ifdef AP_SIG_GRACEFUL
+    apr_signal(AP_SIG_GRACEFUL, restart);
+#endif /* AP_SIG_GRACEFUL */
 #ifdef SIGPIPE
     apr_signal(SIGPIPE, SIG_IGN);
 #endif /* SIGPIPE */
@@ -1254,9 +1255,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     /* If we're doing a graceful_restart then we're going to see a lot
      * of children exiting immediately when we get into the main loop
-     * below (because we just sent them SIGWINCH).  This happens pretty
-     * rapidly... and for each one that exits we'll start a new one until
-     * we reach at least daemons_min_free.  But we may be permitted to
+     * below (because we just sent them AP_SIG_GRACEFUL).  This happens 
+     * pretty rapidly... and for each one that exits we'll start a new one 
+     * until we reach at least daemons_min_free.  But we may be permitted to
      * start more than that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
@@ -1332,7 +1333,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
     
     if (is_graceful) {
        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
-                   "SIGWINCH received.  Doing graceful restart");
+                   AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
 
        /* This is mostly for debugging... so that we know what is still
          * gracefully dealing with existing request.
index eeb5accc1fd2168bd12b79213230fa8032770a18..1647b9d42729fafb136b94ebdfaf41a15f45c88a 100644 (file)
@@ -142,8 +142,9 @@ typedef struct {
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxClients changes across SIGWINCH restarts.  We use this
- * value to optimize routines that have to scan the entire scoreboard.
+ * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We 
+ * use this value to optimize routines that have to scan the entire 
+ * scoreboard.
  */
 int ap_max_daemons_limit = -1;
 
@@ -353,7 +354,7 @@ static void sig_term(int sig)
 
 static void restart(int sig)
 {
-    ap_start_restart(sig == SIGWINCH);
+    ap_start_restart(sig == AP_SIG_GRACEFUL);
 }
 
 static void set_signals(void)
@@ -414,14 +415,15 @@ static void set_signals(void)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
 #endif
 
-    /* we want to ignore HUPs and WINCH while we're busy processing one */
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+     * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
-    sigaddset(&sa.sa_mask, SIGWINCH);
+    sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
-    if (sigaction(SIGWINCH, &sa, NULL) < 0)
-       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
+    if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
+       ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 #else
     if (!one_process) {
        apr_signal(SIGSEGV, sig_coredump);
@@ -449,9 +451,9 @@ static void set_signals(void)
 #ifdef SIGHUP
     apr_signal(SIGHUP, restart);
 #endif /* SIGHUP */
-#ifdef SIGWINCH
-    apr_signal(SIGWINCH, restart);
-#endif /* SIGWINCH */
+#ifdef AP_SIG_GRACEFUL
+    apr_signal(AP_SIG_GRACEFUL, restart);
+#endif /* AP_SIG_GRACEFUL */
 #ifdef SIGPIPE
     apr_signal(SIGPIPE, SIG_IGN);
 #endif /* SIGPIPE */
@@ -1306,7 +1308,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     /* If we're doing a graceful_restart then we're going to see a lot
      * of children exiting immediately when we get into the main loop
-     * below (because we just sent them SIGWINCH).  This happens pretty
+     * below (because we just sent them AP_SIG_GRACEFUL).  This happens pretty
      * rapidly... and for each one that exits we'll start a new one until
      * we reach at least daemons_min_free.  But we may be permitted to
      * start more than that, so we'll just keep track of how many we're
@@ -1384,7 +1386,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
     
     if (is_graceful) {
        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
-                   "SIGWINCH received.  Doing graceful restart");
+                   AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
 
        /* This is mostly for debugging... so that we know what is still
          * gracefully dealing with existing request.
index cdac141592da30be3767d3d2ec85f85b478f3ef1..61fc296c28695ca416872c5b38a7865e982bce5d 100644 (file)
@@ -245,7 +245,7 @@ void ap_process_child_status(apr_proc_t *pid, apr_wait_t status)
         switch (signum) {
         case SIGTERM:
         case SIGHUP:
-        case SIGWINCH:
+        case AP_SIG_GRACEFUL:
         case SIGKILL:
             break;
         default:
index 336aec58250add0dd8beb47a565be58d14cf710d..7cb370a89e5a797c2a0d0febbcef005430e150dc 100644 (file)
@@ -406,17 +406,6 @@ static int read_request_line(request_rec *r)
     }
     /* we've probably got something to do, ignore graceful restart requests */
 
-    /* XXX - sigwait doesn't work if the signal has been SIG_IGNed (under
-     * linux 2.0 w/ glibc 2.0, anyway), and this step isn't necessary when
-     * we're running a sigwait thread anyway. If/when unthreaded mode is
-     * put back in, we should make sure to ignore this signal iff a sigwait
-     * thread isn't used. - mvsk
-
-#ifdef SIGWINCH
-    apr_signal(SIGWINCH, SIG_IGN);
-#endif
-    */
-
     r->request_time = apr_time_now();
     r->the_request = apr_pstrdup(r->pool, l);
     r->method = ap_getword_white(r->pool, &ll);
index cce5c9e7eb405f01b628e3df39164d1278e5ce2c..c37f275d98d6bc1a64e8e68f84c1d43bde0ce4fc 100644 (file)
@@ -125,7 +125,7 @@ do
            fi
        else
            if $HTTPD -t >/dev/null 2>&1; then
-               if kill -WINCH $PID ; then
+               if kill -@AP_SIG_GRACEFUL@ $PID ; then
                    echo "$0 $ARG: httpd gracefully restarted"
                else
                    echo "$0 $ARG: httpd could not be restarted"
@@ -161,7 +161,7 @@ restart    - restart httpd if running by sending a SIGHUP or start if
              not running
 fullstatus - dump a full status screen; requires lynx and mod_status enabled
 status     - dump a short status screen; requires lynx and mod_status enabled
-graceful   - do a graceful restart by sending a SIGWINCH or start if not running
+graceful   - do a graceful restart by sending a @AP_SIG_GRACEFUL@ or start if not running
 configtest - do a configuration syntax test
 help       - this screen