From: Colm MacCarthaigh Date: Fri, 26 Aug 2005 16:00:59 +0000 (+0000) Subject: Make the neccessary changes to mpm_common and main to support a graceful-stop X-Git-Tag: 2.3.0~3073 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=432af0071e53b8d140929bb2b26bcb6408ef3dab;p=apache Make the neccessary changes to mpm_common and main to support a graceful-stop command line argument. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@240269 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/main.c b/server/main.c index 732b10097b..c73a315d29 100644 --- a/server/main.c +++ b/server/main.c @@ -318,9 +318,15 @@ static void usage(process_rec *process) pad); #endif #ifdef AP_MPM_WANT_SIGNAL_SERVER +#ifdef AP_MPM_SUPPORTS_GRACEFUL_STOP + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, + " %s [-k start|restart|graceful|graceful-stop|stop]", + pad); +#else ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, " %s [-k start|restart|graceful|stop]", pad); +#endif /* AP_MPM_SUPPORTS_GRACEFUL_STOP */ #endif ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, " %s [-v] [-V] [-h] [-l] [-L] [-t] [-S]", pad); diff --git a/server/mpm_common.c b/server/mpm_common.c index 93711f7c19..e8a8cb44a4 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -921,6 +921,20 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf) return 1; } } + + if (!strcmp(dash_k_arg, "graceful-stop")) { +#ifdef AP_MPM_SUPPORTS_GRACEFUL_STOP + if (!running) { + printf("%s\n", status); + } + else { + *exit_status = send_signal(otherpid, AP_SIG_GRACEFUL_STOP); + } +#else + printf("httpd MPM \"" MPM_NAME "\" does not support graceful-stop\n"); +#endif + return 1; + } return 0; } @@ -949,7 +963,8 @@ void ap_mpm_rewrite_args(process_rec *process) case 'k': if (!dash_k_arg) { if (!strcmp(optarg, "start") || !strcmp(optarg, "stop") || - !strcmp(optarg, "restart") || !strcmp(optarg, "graceful")) { + !strcmp(optarg, "restart") || !strcmp(optarg, "graceful") || + !strcmp(optarg, "graceful-stop")) { dash_k_arg = optarg; break; }