MCPcopy Create free account
hub / github.com/apache/httpd / event_pre_config

Function event_pre_config

server/mpm/event/event.c:3602–3698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3600}
3601
3602static int event_pre_config(apr_pool_t * pconf, apr_pool_t * plog,
3603 apr_pool_t * ptemp)
3604{
3605 int no_detach, debug, foreground;
3606 apr_status_t rv;
3607 const char *userdata_key = "mpm_event_module";
3608 int test_atomics = 0;
3609
3610 debug = ap_exists_config_define("DEBUG");
3611
3612 if (debug) {
3613 foreground = one_process = 1;
3614 no_detach = 0;
3615 }
3616 else {
3617 one_process = ap_exists_config_define("ONE_PROCESS");
3618 no_detach = ap_exists_config_define("NO_DETACH");
3619 foreground = ap_exists_config_define("FOREGROUND");
3620 }
3621
3622 retained = ap_retained_data_get(userdata_key);
3623 if (!retained) {
3624 retained = ap_retained_data_create(userdata_key, sizeof(*retained));
3625 retained->mpm = ap_unixd_mpm_get_retained_data();
3626 if (retained->mpm->module_loads) {
3627 test_atomics = 1;
3628 }
3629 }
3630 retained->mpm->mpm_state = AP_MPMQ_STARTING;
3631 if (retained->mpm->baton != retained) {
3632 retained->mpm->was_graceful = 0;
3633 retained->mpm->baton = retained;
3634 }
3635 ++retained->mpm->module_loads;
3636
3637 /* test once for correct operation of fdqueue */
3638 if (test_atomics || retained->mpm->module_loads == 2) {
3639 static apr_uint32_t foo1, foo2;
3640
3641 apr_atomic_set32(&foo1, 100);
3642 foo2 = apr_atomic_add32(&foo1, -10);
3643 if (foo2 != 100 || foo1 != 90) {
3644 ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, APLOGNO(02405)
3645 "atomics not working as expected - add32 of negative number");
3646 return HTTP_INTERNAL_SERVER_ERROR;
3647 }
3648 }
3649
3650 /* sigh, want this only the second time around */
3651 if (retained->mpm->module_loads == 2) {
3652 rv = apr_pollset_create(&event_pollset, 1, plog,
3653 APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY);
3654 if (rv != APR_SUCCESS) {
3655 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(00495)
3656 "Couldn't create a Thread Safe Pollset. "
3657 "Is it supported on your platform?"
3658 "Also check system or user limits!");
3659 return HTTP_INTERNAL_SERVER_ERROR;

Callers

nothing calls this directly

Calls 7

ap_exists_config_defineFunction · 0.85
ap_retained_data_getFunction · 0.85
ap_retained_data_createFunction · 0.85
ap_fatal_signal_setupFunction · 0.85
ap_listen_pre_configFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected