httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r240296 - in /httpd/httpd/trunk: include/mpm_common.h server/main.c server/mpm/prefork/mpm.h server/mpm/prefork/prefork.c server/mpm_common.c
Date Fri, 26 Aug 2005 17:43:28 GMT
Author: colm
Date: Fri Aug 26 10:43:24 2005
New Revision: 240296

URL: http://svn.apache.org/viewcvs?rev=240296&view=rev
Log:

Move the "GracefulShutdownTimeout" directive into mpm_common, for re-use
with other MPM's.


Modified:
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/server/main.c
    httpd/httpd/trunk/server/mpm/prefork/mpm.h
    httpd/httpd/trunk/server/mpm/prefork/prefork.c
    httpd/httpd/trunk/server/mpm_common.c

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/mpm_common.h?rev=240296&r1=240295&r2=240296&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Fri Aug 26 10:43:24 2005
@@ -287,6 +287,16 @@
                                    const char *arg);
 #endif
 
+/**
+ * Set the timeout period for a graceful shutdown.
+ */
+#ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
+extern int ap_graceful_shutdown_timeout;
+const char *ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
+                                         const char *arg);
+#endif
+
+
 #ifdef AP_MPM_WANT_SIGNAL_SERVER
 int ap_signal_server(int *, apr_pool_t *);
 void ap_mpm_rewrite_args(process_rec *);

Modified: httpd/httpd/trunk/server/main.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/main.c?rev=240296&r1=240295&r2=240296&view=diff
==============================================================================
--- httpd/httpd/trunk/server/main.c (original)
+++ httpd/httpd/trunk/server/main.c Fri Aug 26 10:43:24 2005
@@ -318,7 +318,7 @@
                  pad);
 #endif
 #ifdef AP_MPM_WANT_SIGNAL_SERVER
-#ifdef AP_MPM_SUPPORTS_GRACEFUL_STOP
+#ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                  "       %s [-k start|restart|graceful|graceful-stop|stop]",
                  pad);
@@ -326,7 +326,7 @@
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                  "       %s [-k start|restart|graceful|stop]",
                  pad);
-#endif /* AP_MPM_SUPPORTS_GRACEFUL_STOP */
+#endif /* AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN */
 #endif
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                  "       %s [-v] [-V] [-h] [-l] [-L] [-t] [-S]", pad);

Modified: httpd/httpd/trunk/server/mpm/prefork/mpm.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/prefork/mpm.h?rev=240296&r1=240295&r2=240296&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/mpm.h (original)
+++ httpd/httpd/trunk/server/mpm/prefork/mpm.h Fri Aug 26 10:43:24 2005
@@ -38,8 +38,8 @@
 #define AP_MPM_WANT_SIGNAL_SERVER
 #define AP_MPM_WANT_SET_MAX_MEM_FREE
 #define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
+#define AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
 #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
-#define AP_MPM_SUPPORTS_GRACEFUL_STOP
 
 #define AP_MPM_USES_POD 1
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)

Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=240296&r1=240295&r2=240296&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Fri Aug 26 10:43:24 2005
@@ -96,7 +96,6 @@
 static int ap_daemons_min_free=0;
 static int ap_daemons_max_free=0;
 static int ap_daemons_limit=0;      /* MaxClients */
-static int graceful_shutdown_timeout = 0;
 static int server_limit = DEFAULT_SERVER_LIMIT;
 static int first_server_limit;
 static int changed_limit_at_restart;
@@ -1122,7 +1121,7 @@
         int status;
         int child_slot;
         apr_proc_t pid;
-        apr_time_t cutoff;
+        apr_time_t cutoff = 0;
 
         /* Stop listening */
         ap_close_listeners();
@@ -1168,9 +1167,9 @@
         ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
            "caught " AP_SIG_GRACEFUL_STOP_STRING ", shutting down gracefully");
 
-        if (graceful_shutdown_timeout) {
+        if (ap_graceful_shutdown_timeout) {
             cutoff = apr_time_now() + 
-                     apr_time_from_sec(graceful_shutdown_timeout);
+                     apr_time_from_sec(ap_graceful_shutdown_timeout);
         }
 
         /* Don't really exit until each child has finished */
@@ -1198,7 +1197,7 @@
                 }
             }
         } while (!shutdown_pending && active_children &&
-                 (!graceful_shutdown_timeout || apr_time_now() < cutoff));
+                 (!ap_graceful_shutdown_timeout || apr_time_now() < cutoff));
 
         /* We might be here because we received SIGTERM, either
          * way, try and make sure that all of our processes are
@@ -1473,16 +1472,6 @@
     return NULL;
 }
 
-static const char *set_graceful_shutdown(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-    graceful_shutdown_timeout = atoi(arg);
-    return NULL;
-}
-
 static const command_rec prefork_cmds[] = {
 UNIX_DAEMON_COMMANDS,
 LISTEN_COMMANDS,
@@ -1496,9 +1485,9 @@
               "Maximum number of children alive at the same time"),
 AP_INIT_TAKE1("ServerLimit", set_server_limit, NULL, RSRC_CONF,
               "Maximum value of MaxClients for this run of Apache"),
-AP_INIT_TAKE1("GracefulShutdownTimeout", set_graceful_shutdown, NULL, RSRC_CONF,
-              "Time in seconds to wait for child processes to complete " 
-              "transactions during shutdown"),
+AP_INIT_TAKE1("GracefulShutdownTimeout", ap_mpm_set_graceful_shutdown, NULL, 
+              RSRC_CONF, "Time in seconds to wait for child processes to " 
+              "complete transactions during shutdown"),
 { NULL }
 };
 

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm_common.c?rev=240296&r1=240295&r2=240296&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Fri Aug 26 10:43:24 2005
@@ -760,6 +760,21 @@
 }
 #endif
 
+#ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
+int ap_graceful_shutdown_timeout = 0;
+
+const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
+                                          const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+    ap_graceful_shutdown_timeout = atoi(arg);
+    return NULL;
+}
+#endif
+
 #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
 apr_lockmech_e ap_accept_lock_mech = APR_LOCK_DEFAULT;
 
@@ -923,7 +938,7 @@
     }
     
     if (!strcmp(dash_k_arg, "graceful-stop")) {
-#ifdef AP_MPM_SUPPORTS_GRACEFUL_STOP
+#ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
         if (!running) {
             printf("%s\n", status);
         }



Mime
View raw message