From: Jeff Trawick Date: Sun, 5 Apr 2009 17:54:22 +0000 (+0000) Subject: main() can use ap_run_mpm() directly, so axe the old ap_mpm_run() function X-Git-Tag: 2.3.3~733 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1c34162827dbdb234f676727633040cf293dab2;p=apache main() can use ap_run_mpm() directly, so axe the old ap_mpm_run() function change the mpm hooks to return OK/DONE instead of 0/1 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@762127 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_mpm.h b/include/ap_mpm.h index d5844a912c..3a0da9de5d 100644 --- a/include/ap_mpm.h +++ b/include/ap_mpm.h @@ -80,16 +80,15 @@ extern "C" { */ /** - * This is the function that passes control to the MPM for steady-state - * processing. It is responsible for controlling the parent and child - * processes. It will run until a restart/shutdown is indicated. + * Pass control to the MPM for steady-state processing. It is responsible + * for controlling the parent and child processes. It will run until a + * restart/shutdown is indicated. * @param pconf the configuration pool, reset before the config file is read * @param plog the log pool, reset after the config file is read * @param server_conf the global server config. - * @return 1 for shutdown 0 otherwise. - * @fn int ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf) + * @return DONE for shutdown OK otherwise. */ -AP_DECLARE(int) ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf); +AP_DECLARE_HOOK(int, mpm, (apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf)) /** * Spawn a process with privileges that another module has requested diff --git a/include/mpm_common.h b/include/mpm_common.h index 511ae1cd7c..0e8143b5c3 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -320,9 +320,6 @@ AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p)) AP_DECLARE(int) ap_sys_privileges_handlers(int inc); AP_DECLARE_HOOK(int, drop_privileges, (apr_pool_t * pchild, server_rec * s)) -/* pass control to the MPM */ -AP_DECLARE_HOOK(int, mpm, (apr_pool_t *pconf, apr_pool_t *plog, server_rec *s)) - /* implement the ap_mpm_query() function * The MPM should return OK+APR_ENOTIMPL for any unimplemented query codes; * modules which intercede for specific query codes should DECLINE for others. diff --git a/server/main.c b/server/main.c index 948c56f7d6..d44ee4e796 100644 --- a/server/main.c +++ b/server/main.c @@ -39,7 +39,6 @@ #include "apr_uri.h" #include "util_ebcdic.h" #include "ap_mpm.h" -#include "mpm_common.h" #include "ap_expr.h" #if APR_HAVE_UNISTD_H @@ -779,7 +778,7 @@ int main(int argc, const char * const argv[]) ap_run_optional_fn_retrieve(); - if (ap_mpm_run(pconf, plog, ap_server_conf)) + if (ap_run_mpm(pconf, plog, ap_server_conf) != OK) break; apr_pool_lock(pconf, 0); diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index fac39c49b8..84bd2a6831 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -2210,7 +2210,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s) if (!is_graceful) { if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } /* fix the generation number in the global score; we just got a new, * cleared scoreboard @@ -2278,7 +2278,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s) ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, "caught SIGTERM, shutting down"); } - return 1; + return DONE; } else if (shutdown_pending) { /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... @@ -2339,7 +2339,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s) ap_event_pod_killpg(pod, ap_daemons_limit, FALSE); ap_reclaim_child_processes(1); - return 1; + return DONE; } /* we've been told to restart */ @@ -2347,7 +2347,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s) if (one_process) { /* not worth thinking about */ - return 1; + return DONE; } /* advance to the next generation */ @@ -2382,7 +2382,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s) "SIGHUP received. Attempting to restart"); } - return 0; + return OK; } /* This really should be a post_config hook, but the error log is already diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 3b9d4fd6cb..d1559c7997 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -915,7 +915,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "Couldn't create accept lock (%s) (%d)", ap_lock_fname, ap_accept_lock_mech); mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } #if APR_USE_SYSVSEM_SERIALIZE @@ -930,14 +930,14 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "Couldn't set permissions on cross-process lock; " "check User and Group directives"); mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } } if (!is_graceful) { if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } /* fix the generation number in the global score; we just got a new, * cleared scoreboard @@ -1008,7 +1008,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) processed_status = ap_process_child_status(&pid, exitwhy, status); if (processed_status == APEXIT_CHILDFATAL) { mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } /* non-fatal death... note that it's gone in the scoreboard. */ @@ -1095,7 +1095,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, "caught SIGTERM, shutting down"); - return 1; + return DONE; } else if (shutdown_pending) { /* Time to perform a graceful shut down: * Reap the inactive children, and ask the active ones @@ -1169,7 +1169,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) */ ap_unixd_killpg(getpgrp(), SIGTERM); - return 1; + return DONE; } /* we've been told to restart */ @@ -1177,7 +1177,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) apr_signal(AP_SIG_GRACEFUL, SIG_IGN); if (one_process) { /* not worth thinking about */ - return 1; + return DONE; } /* advance to the next generation */ @@ -1223,7 +1223,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "SIGHUP received. Attempting to restart"); } - return 0; + return OK; } /* This really should be a post_config hook, but the error log is already diff --git a/server/mpm/simple/simple_api.c b/server/mpm/simple/simple_api.c index 24b4a6af31..1023cd6fa4 100644 --- a/server/mpm/simple/simple_api.c +++ b/server/mpm/simple/simple_api.c @@ -35,7 +35,7 @@ static int simple_run(apr_pool_t * pconf, apr_pool_t * plog, server_rec * s) if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { sc->mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } return simple_main_loop(sc); diff --git a/server/mpm/simple/simple_run.c b/server/mpm/simple/simple_run.c index 0004885273..3ac7046943 100644 --- a/server/mpm/simple/simple_run.c +++ b/server/mpm/simple/simple_run.c @@ -177,7 +177,7 @@ static int simple_run_loop(simple_core_t * sc) if (!APR_STATUS_IS_EINTR(rv) && !APR_STATUS_IS_TIMEUP(rv)) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, "simple_main_loop: apr_pollcb_poll failed"); - return !OK; + return DONE; } } @@ -225,7 +225,7 @@ static int simple_run_loop(simple_core_t * sc) } } - return 0; + return OK; } void simple_single_process_hack(simple_core_t * sc) diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index dcbf00d5ea..6cac77a99c 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1671,7 +1671,7 @@ static int winnt_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s ) if (!restart && ((parent_pid == my_pid) || one_process)) { /* Set up the scoreboard. */ if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { - return 1; + return DONE; } } @@ -1686,7 +1686,7 @@ static int winnt_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s ) ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, "Child %d: Child process is exiting", my_pid); - return 1; + return DONE; } else { @@ -1714,11 +1714,11 @@ static int winnt_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s ) CloseHandle(restart_event); CloseHandle(shutdown_event); - return 1; + return DONE; } } - return 0; /* Restart */ + return OK; /* Restart */ } static void winnt_hooks(apr_pool_t *p) diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 9971162b15..45840328b8 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -1695,7 +1695,7 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't create accept lock"); mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } #if APR_USE_SYSVSEM_SERIALIZE @@ -1710,14 +1710,14 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "Couldn't set permissions on cross-process lock; " "check User and Group directives"); mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } } if (!is_graceful) { if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) { mpm_state = AP_MPMQ_STOPPING; - return 1; + return DONE; } /* fix the generation number in the global score; we just got a new, * cleared scoreboard @@ -1788,7 +1788,7 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, "caught SIGTERM, shutting down"); } - return 1; + return DONE; } else if (shutdown_pending) { /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... @@ -1849,7 +1849,7 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) ap_worker_pod_killpg(pod, ap_daemons_limit, FALSE); ap_reclaim_child_processes(1); - return 1; + return DONE; } /* we've been told to restart */ @@ -1857,7 +1857,7 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) if (one_process) { /* not worth thinking about */ - return 1; + return DONE; } /* advance to the next generation */ diff --git a/server/mpm_common.c b/server/mpm_common.c index 59e175306f..e7af61db8a 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -398,11 +398,6 @@ const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy, return NULL; } -AP_DECLARE(int) ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf) -{ - return ap_run_mpm(pconf, plog, server_conf); -} - AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) { apr_status_t rv;