module **mod;
const char *opt_arg;
APR_OPTIONAL_FN_TYPE(ap_signal_server) *signal_server;
+ int rc = OK;
AP_MONCONTROL(0); /* turn off profiling of startup */
apr_pool_destroy(ptemp);
- for (;;) {
+ do {
ap_main_state = AP_SQ_MS_DESTROY_CONFIG;
apr_hook_deregister_all();
apr_pool_clear(pconf);
ap_run_optional_fn_retrieve();
ap_main_state = AP_SQ_MS_RUN_MPM;
- if (ap_run_mpm(pconf, plog, ap_server_conf) != OK)
- break;
+ rc = ap_run_mpm(pconf, plog, ap_server_conf);
apr_pool_lock(pconf, 0);
- }
- apr_pool_lock(pconf, 0);
- destroy_and_exit_process(process, 0);
+ } while (rc == OK);
+
+ if (rc == DONE) {
+ rc = OK;
+ }
+ else if (rc != OK) {
+ ap_log_error(APLOG_MARK, APLOG_EMERG, 0, NULL, APLOGNO()
+ "MPM run failed, exiting");
+ }
+ destroy_and_exit_process(process, rc);
- return 0; /* Termination 'ok' */
+ /* NOTREACHED */
+ return !OK;
}
#ifdef AP_USING_AUTOCONF
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard
ap_mpm_child_main(pconf);
/* Outta here */
- return 1;
+ return DONE;
}
else {
/* Parent process */
if (ap_setup_listeners(ap_server_conf) < 1) {
ap_log_error(APLOG_MARK, APLOG_ALERT, 0, s, APLOGNO(00200)
"no listening sockets available, shutting down");
- return 1;
+ return !OK;
}
ap_log_pid(pconf, ap_pid_fname);
ap_remove_pid(pconf, ap_pid_fname);
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00201)
"caught SIGTERM, shutting down");
- return 1;
+ return DONE;
}
} /* Parent process */
- return 0; /* Restart */
+ return OK; /* Restart */
}
if (setup_listeners(s)) {
ap_log_error(APLOG_MARK, APLOG_ALERT, status, s, APLOGNO(00223)
"no listening sockets available, shutting down");
- return -1;
+ return !OK;
}
restart_pending = shutdown_pending = 0;
if (!is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_NOT_SHARED) != OK) {
- return 1;
+ return !OK;
}
}
}
mpm_main_cleanup();
- return 1;
+ return DONE;
}
else { /* the only other way out is a restart */
/* advance to the next generation */
}
mpm_main_cleanup();
- return 0;
+ return OK;
}
static int netware_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
s, _pconf, 0);
if (rv != APR_SUCCESS) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
}
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard
make_child(ap_server_conf, 0, 0);
/* NOTREACHED */
ap_assert(0);
- return DONE;
+ return !OK;
}
/* Don't thrash... */
|| ap_get_scoreboard_process(child_slot)->generation
== retained->my_generation) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
else {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, APLOGNO(00166)
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
sc->mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
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 DONE;
+ return !OK;
}
}
rv = simple_setup_pollcb(sc);
if (rv) {
- return rv;
+ return !OK;
}
rv = simple_setup_workers(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 DONE;
+ return !OK;
}
}
s, _pconf, 0);
if (rv != APR_SUCCESS) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
}
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard