]> granicus.if.org Git - apache/commitdiff
catch SIGWINCH in the parent process and set appropriate flags
authorJeff Trawick <trawick@apache.org>
Thu, 14 Jun 2001 14:07:07 +0000 (14:07 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 14 Jun 2001 14:07:07 +0000 (14:07 +0000)
so that we write to the pod to tell the servers to go away

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

server/mpm/prefork/prefork.c

index c90b07fc03c1f55b2c15c4826aab165d12a765fc..e2857b1d5315e967f25c97f02150343aba574025 100644 (file)
@@ -406,6 +406,9 @@ static void sig_term(int sig)
     shutdown_pending = 1;
 }
 
+/* restart() is the signal handler for SIGHUP and SIGWINCH
+ * in the parent process, unless running in ONE_PROCESS mode
+ */
 static void restart(int sig)
 {
     if (restart_pending == 1) {
@@ -413,11 +416,9 @@ static void restart(int sig)
        return;
     }
     restart_pending = 1;
-#if 0
     if ((is_graceful = (sig == SIGWINCH))) {
         apr_pool_cleanup_kill(pconf, NULL, ap_cleanup_scoreboard);
     }
-#endif
 }
 
 static void set_signals(void)
@@ -480,9 +481,12 @@ static void set_signals(void)
 
     /* we want to ignore HUPs and WINCH while we're busy processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
+    sigaddset(&sa.sa_mask, SIGWINCH);
     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)");
 #else
     if (!one_process) {
        apr_signal(SIGSEGV, sig_coredump);
@@ -511,7 +515,7 @@ static void set_signals(void)
     apr_signal(SIGHUP, restart);
 #endif /* SIGHUP */
 #ifdef SIGWINCH
-    apr_signal(SIGWINCH, SIG_IGN);
+    apr_signal(SIGWINCH, restart);
 #endif /* SIGWINCH */
 #ifdef SIGPIPE
     apr_signal(SIGPIPE, SIG_IGN);
@@ -889,6 +893,10 @@ static int make_child(server_rec *s, int slot)
         */
        apr_signal(SIGHUP, please_die_gracefully);
        apr_signal(SIGTERM, just_die);
+        /* The child process doesn't do anything for SIGWINCH.  Instead, the
+         * pod is used for signalling graceful restart.
+         */
+        apr_signal(SIGWINCH, SIG_IGN);
         ap_scoreboard_image->parent[slot].process_status = SB_WORKING;
        child_main(slot);
     }