]> granicus.if.org Git - apache/commitdiff
Make scoreboard creation a hook. This allows management
authorRyan Bloom <rbb@apache.org>
Wed, 18 Jul 2001 20:45:36 +0000 (20:45 +0000)
committerRyan Bloom <rbb@apache.org>
Wed, 18 Jul 2001 20:45:36 +0000 (20:45 +0000)
modules to have access to the scoreboard at the time that it is
created, and at every restart request.
Submitted by: Cody Sherr <csherr@covalent.net>
Reviewed by: Ryan Bloom

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89608 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/scoreboard.h
server/core.c
server/mpm/beos/beos.c
server/mpm/experimental/perchild/perchild.c
server/mpm/perchild/perchild.c
server/mpm/prefork/prefork.c
server/mpm/spmt_os2/spmt_os2.c
server/mpm/threaded/threaded.c
server/mpm/winnt/mpm_winnt.c
server/scoreboard.c

diff --git a/CHANGES b/CHANGES
index 2e6397ceca11a585edce1635344de49be8994001..9e2a4722e81c5e05cd7db1b05acf04f01e645597 100644 (file)
--- 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 <csherr@covalent.net>]
+
   *) 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
index 2eadbf1d345909a75e3efc62dd7ad42bec6f1a43..e1ecfbb56e1fed30b07c2a3348f7db72aed5d1a6 100644 (file)
@@ -69,7 +69,9 @@ extern "C" {
 #include <time.h>
 #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
index fd0d04d5de2e43bc00830e90517962f09068cdfd..9cc5d181f7334386f2b5f6bde77afdddce555256 100644 (file)
@@ -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
index e1df4bc1f2a9cf49e2705c64e9ec62084716794f..1d16c4221a2c594a7cd4b86b9cfd5f0cba66b5d8 100644 (file)
@@ -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++) {
index 188bace271cab3cf8ba3f8feddfe6fcea1c35824..28aa933f5563aebd1f0c72b0a9fca9b492ca0202 100644 (file)
@@ -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) {
index 188bace271cab3cf8ba3f8feddfe6fcea1c35824..28aa933f5563aebd1f0c72b0a9fca9b492ca0202 100644 (file)
@@ -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) {
index d006ab8e10262ce1cb20b8a18ac10a3878c3ba35..e665d8667354d7eb8eb3375f95914bb183c3730a 100644 (file)
@@ -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 {
index 365f86abefe64e4549e5e3c79d33c4236c6e6abd..f8b9c859db8ac7a066afa666ebdf6d3baa1e347c 100644 (file)
@@ -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));
     }
 
index 0f9a7b3fcba433244caa41ab7517fdb7a3e4c5f0..266350e28ffa98e7359baeb2d73f10d30f92315e 100644 (file)
@@ -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();
index af024575d616881ea2527347ace632f71f80cec3..9910c7d9bbbd35df65963398cb4f874aab9ded2f 100644 (file)
@@ -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;
index 32d5fcf0db189ff87b207b58a6aa6f6baaa0afed..dd4feb365f18e7db19e8a6fc14ca15b79c0d9134 100644 (file)
@@ -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