in modules/fcgid/fcgid_pm_unix.c [126:187]
static void fcgid_maint(int reason, void *data, apr_wait_t status)
{
apr_proc_t *proc = data;
int mpm_state;
switch (reason) {
case APR_OC_REASON_DEATH:
apr_proc_other_child_unregister(data);
if (ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state) == APR_SUCCESS
&& mpm_state != AP_MPMQ_STOPPING) {
if (status == DAEMON_STARTUP_ERROR) {
ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL,
"mod_fcgid: fcgid process manager failed to initialize; "
"stopping httpd");
/* mod_fcgid requests will hang due to lack of a process manager;
* try to terminate httpd
*/
kill(getpid(), SIGTERM);
}
else {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
"mod_fcgid: fcgid process manager died, restarting the server");
/* HACK: I can't just call create_process_manager() to
restart a process manager, because it will use the dirty
share memory, I have to kill myself a SIGHUP, to make
a clean restart */
/* FIXME: This is the httpd parent; mod_fcgid is doing a hard
* restart of the server!
*/
if (kill(getpid(), SIGHUP) < 0) {
ap_log_error(APLOG_MARK, APLOG_EMERG,
apr_get_os_error(), NULL,
"mod_fcgid: can't send SIGHUP to self");
exit(0);
}
}
}
break;
case APR_OC_REASON_RESTART:
apr_proc_other_child_unregister(data);
break;
case APR_OC_REASON_LOST:
apr_proc_other_child_unregister(data);
/* It hack here too, a note above */
/* FIXME: This is the httpd parent; mod_fcgid is doing a hard
* restart of the server!
*/
if (kill(getpid(), SIGHUP) < 0) {
ap_log_error(APLOG_MARK, APLOG_EMERG,
apr_get_os_error(), NULL,
"mod_fcgid: can't send SIGHUP to self");
exit(0);
}
break;
case APR_OC_REASON_UNREGISTER:
/* I don't think it's going to happen */
kill(proc->pid, SIGHUP);
break;
}
}