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 *);
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);
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);
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;
int status;
int child_slot;
apr_proc_t pid;
- apr_time_t cutoff;
+ apr_time_t cutoff = 0;
/* Stop listening */
ap_close_listeners();
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 */
}
}
} 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
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,
"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 }
};
}
#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;
}
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);
}