From: Ryan Bloom Date: Wed, 18 Jul 2001 20:45:36 +0000 (+0000) Subject: Make scoreboard creation a hook. This allows management X-Git-Tag: 2.0.21~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d8f3ce64bb5ab84d8e84352a2c819cf24f6e395;p=thirdparty%2Fapache%2Fhttpd.git Make scoreboard creation a hook. This allows management modules to have access to the scoreboard at the time that it is created, and at every restart request. Submitted by: Cody Sherr Reviewed by: Ryan Bloom git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89608 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 2e6397ceca1..9e2a4722e81 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ Changes with Apache 2.0.21-dev + *) Make scoreboard creation a hook. This allows management + modules to have access to the scoreboard at the time that it is + created, and at every restart request. + [Cody Sherr ] + *) Changed AP_MPMQ_MAX_DAEMONS to refer to MaxClients and added an AP_MPMQ_MAX_DAEMON_USED to refer to the highest daemon index actually used in the scoreboard. I also diff --git a/include/scoreboard.h b/include/scoreboard.h index 2eadbf1d345..e1ecfbb56e1 100644 --- a/include/scoreboard.h +++ b/include/scoreboard.h @@ -69,7 +69,9 @@ extern "C" { #include #endif +#include "ap_config.h" #include "mpm_default.h" /* For HARD_.*_LIMIT */ +#include "apr_hooks.h" #include "apr_thread_proc.h" #include "apr_portable.h" @@ -221,6 +223,15 @@ AP_DECLARE_DATA extern apr_time_t ap_restart_time; AP_DECLARE_DATA extern ap_generation_t volatile ap_my_generation; +/* Hooks */ +/** + * Hook for post scoreboard creation, pre mpm. + * @param p Apache pool to allocate from. + * @param sb_type + * @ingroup hooks + */ +AP_DECLARE_HOOK(void, pre_mpm, (apr_pool_t *p, ap_scoreboard_e sb_type)) + /* for time_process_request() in http_main.c */ #define START_PREQUEST 1 #define STOP_PREQUEST 2 diff --git a/server/core.c b/server/core.c index fd0d04d5de2..9cc5d181f73 100644 --- a/server/core.c +++ b/server/core.c @@ -3319,6 +3319,7 @@ static void register_hooks(apr_pool_t *p) ap_hook_type_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST); ap_hook_access_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST); ap_hook_create_request(core_create_req, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_pre_mpm(ap_create_scoreboard, NULL, NULL, APR_HOOK_MIDDLE); /* register the core's insert_filter hook and register core-provided * filters diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index e1df4bc1f2a..1d16c4221a2 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -767,7 +767,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) */ if (!is_graceful) - ap_create_scoreboard(pconf, SB_SHARED); + ap_run_pre_mpm(pconf, SB_SHARED); if (!is_graceful) { for (i = 0; i < HARD_SERVER_LIMIT; i++) { diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index 188bace271c..28aa933f556 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -1211,7 +1211,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (!is_graceful) { - ap_create_scoreboard(pconf, SB_SHARED); + ap_run_pre_mpm(pconf, SB_SHARED); } /* Initialize the child table */ if (!is_graceful) { diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index 188bace271c..28aa933f556 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -1211,7 +1211,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (!is_graceful) { - ap_create_scoreboard(pconf, SB_SHARED); + ap_run_pre_mpm(pconf, SB_SHARED); } /* Initialize the child table */ if (!is_graceful) { diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index d006ab8e102..e665d866735 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1109,7 +1109,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) SAFE_ACCEPT(accept_mutex_init(pconf)); if (!is_graceful) { - ap_create_scoreboard(pconf, SB_SHARED); + ap_run_pre_mpm(pconf, SB_SHARED); } #ifdef SCOREBOARD_FILE else { diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index 365f86abefe..f8b9c859db8 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -941,7 +941,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) SAFE_ACCEPT(accept_mutex_init(pconf)); if (!is_graceful) { - ap_create_scoreboard(pconf, SB_NOT_SHARED); + ap_run_pre_mpm(pconf, SB_NOT_SHARED); memset(thread_control, 0, sizeof(thread_control)); } diff --git a/server/mpm/threaded/threaded.c b/server/mpm/threaded/threaded.c index 0f9a7b3fcba..266350e28ff 100644 --- a/server/mpm/threaded/threaded.c +++ b/server/mpm/threaded/threaded.c @@ -1168,7 +1168,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (!is_graceful) { - ap_create_scoreboard(pconf, SB_SHARED); + ap_run_pre_mpm(pconf, SB_SHARED); } set_signals(); diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index af024575d61..9910c7d9bbb 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1981,7 +1981,7 @@ AP_DECLARE(int) ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s ) "Child %d: Child process is running", my_pid); /* Set up the scoreboard. */ - ap_create_scoreboard(pconf, SB_NOT_SHARED); + ap_run_pre_mpm(pconf, SB_NOT_SHARED); if (one_process) { if (ap_setup_listeners(server_conf) < 1) { return 1; diff --git a/server/scoreboard.c b/server/scoreboard.c index 32d5fcf0db1..dd4feb365f1 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -88,6 +88,15 @@ AP_DECLARE_DATA apr_time_t ap_restart_time = 0; #include "apr_shmem.h" static apr_shmem_t *scoreboard_shm = NULL; #endif + +APR_HOOK_STRUCT( + APR_HOOK_LINK(pre_mpm) +) + +AP_IMPLEMENT_HOOK_VOID(pre_mpm, + (apr_pool_t *p, ap_scoreboard_e sb_type), + (p, sb_type)) + /* * ToDo: * This function should be renamed to cleanup_shared