Lines 437-447
AP_DECLARE(apr_status_t) ap_unixd_accept(void **ac
Link Here
|
437 |
/* Unixes MPMs' */ |
437 |
/* Unixes MPMs' */ |
438 |
|
438 |
|
439 |
static ap_unixd_mpm_retained_data *retained_data = NULL; |
439 |
static ap_unixd_mpm_retained_data *retained_data = NULL; |
|
|
440 |
static apr_status_t retained_data_cleanup(void *unused) |
441 |
{ |
442 |
(void)unused; |
443 |
retained_data = NULL; |
444 |
return APR_SUCCESS; |
445 |
} |
446 |
|
440 |
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data() |
447 |
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data() |
441 |
{ |
448 |
{ |
442 |
if (!retained_data) { |
449 |
if (!retained_data) { |
443 |
retained_data = ap_retained_data_create("ap_unixd_mpm_retained_data", |
450 |
retained_data = ap_retained_data_create("ap_unixd_mpm_retained_data", |
444 |
sizeof(*retained_data)); |
451 |
sizeof(*retained_data)); |
|
|
452 |
apr_pool_pre_cleanup_register(ap_pglobal, NULL, retained_data_cleanup); |
445 |
retained_data->mpm_state = AP_MPMQ_STARTING; |
453 |
retained_data->mpm_state = AP_MPMQ_STARTING; |
446 |
} |
454 |
} |
447 |
return retained_data; |
455 |
return retained_data; |
Lines 449-454
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_
Link Here
|
449 |
|
457 |
|
450 |
static void sig_term(int sig) |
458 |
static void sig_term(int sig) |
451 |
{ |
459 |
{ |
|
|
460 |
if (!retained_data) { |
461 |
/* Main process (ap_pglobal) is dying */ |
462 |
return; |
463 |
} |
452 |
retained_data->mpm_state = AP_MPMQ_STOPPING; |
464 |
retained_data->mpm_state = AP_MPMQ_STOPPING; |
453 |
if (retained_data->shutdown_pending |
465 |
if (retained_data->shutdown_pending |
454 |
&& (retained_data->is_ungraceful |
466 |
&& (retained_data->is_ungraceful |
Lines 465-470
static void sig_term(int sig)
Link Here
|
465 |
|
477 |
|
466 |
static void sig_restart(int sig) |
478 |
static void sig_restart(int sig) |
467 |
{ |
479 |
{ |
|
|
480 |
if (!retained_data) { |
481 |
/* Main process (ap_pglobal) is dying */ |
482 |
return; |
483 |
} |
468 |
retained_data->mpm_state = AP_MPMQ_STOPPING; |
484 |
retained_data->mpm_state = AP_MPMQ_STOPPING; |
469 |
if (retained_data->restart_pending |
485 |
if (retained_data->restart_pending |
470 |
&& (retained_data->is_ungraceful |
486 |
&& (retained_data->is_ungraceful |
Lines 481-486
static void sig_restart(int sig)
Link Here
|
481 |
|
497 |
|
482 |
static apr_status_t unset_signals(void *unused) |
498 |
static apr_status_t unset_signals(void *unused) |
483 |
{ |
499 |
{ |
|
|
500 |
if (!retained_data) { |
501 |
/* Main process (ap_pglobal) is dying */ |
502 |
return APR_SUCCESS; |
503 |
} |
484 |
retained_data->shutdown_pending = retained_data->restart_pending = 0; |
504 |
retained_data->shutdown_pending = retained_data->restart_pending = 0; |
485 |
retained_data->was_graceful = !retained_data->is_ungraceful; |
505 |
retained_data->was_graceful = !retained_data->is_ungraceful; |
486 |
retained_data->is_ungraceful = 0; |
506 |
retained_data->is_ungraceful = 0; |
Lines 494-499
AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool
Link Here
|
494 |
struct sigaction sa; |
514 |
struct sigaction sa; |
495 |
#endif |
515 |
#endif |
496 |
|
516 |
|
|
|
517 |
if (!one_process) { |
518 |
ap_fatal_signal_setup(ap_server_conf, pconf); |
519 |
} |
520 |
|
497 |
/* Signals' handlers depend on retained data */ |
521 |
/* Signals' handlers depend on retained data */ |
498 |
(void)ap_unixd_mpm_get_retained_data(); |
522 |
(void)ap_unixd_mpm_get_retained_data(); |
499 |
|
523 |
|