*/
/**
- * 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
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.
#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
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);
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
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...
ap_event_pod_killpg(pod, ap_daemons_limit, FALSE);
ap_reclaim_child_processes(1);
- return 1;
+ return DONE;
}
/* we've been told to restart */
if (one_process) {
/* not worth thinking about */
- return 1;
+ return DONE;
}
/* advance to the next generation */
"SIGHUP received. Attempting to restart");
}
- return 0;
+ return OK;
}
/* This really should be a post_config hook, but the error log is already
"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
"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
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. */
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
*/
ap_unixd_killpg(getpgrp(), SIGTERM);
- return 1;
+ return DONE;
}
/* we've been told to restart */
apr_signal(AP_SIG_GRACEFUL, SIG_IGN);
if (one_process) {
/* not worth thinking about */
- return 1;
+ return DONE;
}
/* advance to the next generation */
"SIGHUP received. Attempting to restart");
}
- return 0;
+ return OK;
}
/* This really should be a post_config hook, but the error log is already
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);
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;
}
}
}
}
- return 0;
+ return OK;
}
void simple_single_process_hack(simple_core_t * sc)
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;
}
}
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
{
CloseHandle(restart_event);
CloseHandle(shutdown_event);
- return 1;
+ return DONE;
}
}
- return 0; /* Restart */
+ return OK; /* Restart */
}
static void winnt_hooks(apr_pool_t *p)
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
"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
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...
ap_worker_pod_killpg(pod, ap_daemons_limit, FALSE);
ap_reclaim_child_processes(1);
- return 1;
+ return DONE;
}
/* we've been told to restart */
if (one_process) {
/* not worth thinking about */
- return 1;
+ return DONE;
}
/* advance to the next generation */
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;