You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Cody Sherr <cs...@covalent.net> on 2001/07/17 02:40:59 UTC
new hook for pre mpm phase
This patch creates a new hook, pre_mpm. ap_create_scoreboard is moved to a
function registered with the pre_mpm hook.
This allows modules like mod_snmp and others to register further functions
to be run in relation to the creation of the scoreboard, and before mpm.
--
Cody Sherr
Engineer
Covalent Technologies
phone: (415)536-5292
email: csherr@covalent.net
Index: include/scoreboard.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/scoreboard.h,v
retrieving revision 1.25
diff -u -r1.25 scoreboard.h
--- include/scoreboard.h 2001/07/16 02:29:33 1.25
+++ include/scoreboard.h 2001/07/17 00:25:04
@@ -69,7 +69,9 @@
#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"
@@ -220,6 +222,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
Index: server/core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
retrieving revision 1.25
diff -u -r1.25 core.c
--- server/core.c 2001/07/06 18:41:56 1.25
+++ server/core.c 2001/07/17 00:25:06
@@ -3319,6 +3319,7 @@
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: server/scoreboard.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/scoreboard.c,v
retrieving revision 1.27
diff -u -r1.27 scoreboard.c
--- server/scoreboard.c 2001/07/16 02:29:33 1.27
+++ server/scoreboard.c 2001/07/17 00:25:06
@@ -88,6 +88,15 @@
#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
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.53
diff -u -r1.53 beos.c
--- server/mpm/beos/beos.c 2001/06/27 17:43:33 1.53
+++ server/mpm/beos/beos.c 2001/07/17 00:25:06
@@ -764,7 +764,7 @@
*/
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: server/mpm/perchild/perchild.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/perchild/perchild.c,v
retrieving revision 1.69
diff -u -r1.69 perchild.c
--- server/mpm/perchild/perchild.c 2001/06/27 17:43:36 1.69
+++ server/mpm/perchild/perchild.c 2001/07/17 00:25:07
@@ -1208,7 +1208,7 @@
}
if (!is_graceful) {
- ap_create_scoreboard(pconf, SB_SHARED);
+ ap_run_pre_mpm(pconf, SB_SHARED);
}
/* Initialize the child table */
if (!is_graceful) {
Index: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.190
diff -u -r1.190 prefork.c
--- server/mpm/prefork/prefork.c 2001/07/16 02:29:33 1.190
+++ server/mpm/prefork/prefork.c 2001/07/17 00:25:07
@@ -1106,7 +1106,7 @@
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: server/mpm/spmt_os2/spmt_os2.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/spmt_os2/spmt_os2.c,v
retrieving revision 1.96
diff -u -r1.96 spmt_os2.c
--- server/mpm/spmt_os2/spmt_os2.c 2001/06/27 17:43:43 1.96
+++ server/mpm/spmt_os2/spmt_os2.c 2001/07/17 00:25:07
@@ -938,7 +938,7 @@
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: server/mpm/threaded/threaded.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/threaded/threaded.c,v
retrieving revision 1.44
diff -u -r1.44 threaded.c
--- server/mpm/threaded/threaded.c 2001/07/03 13:58:10 1.44
+++ server/mpm/threaded/threaded.c 2001/07/17 00:25:08
@@ -1165,7 +1165,7 @@
}
if (!is_graceful) {
- ap_create_scoreboard(pconf, SB_SHARED);
+ ap_run_pre_mpm(pconf, SB_SHARED);
}
set_signals();
Index: server/mpm/winnt/mpm_winnt.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.163
diff -u -r1.163 mpm_winnt.c
--- server/mpm/winnt/mpm_winnt.c 2001/07/16 18:14:51 1.163
+++ server/mpm/winnt/mpm_winnt.c 2001/07/17 00:25:08
@@ -1978,7 +1978,7 @@
"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;
Re: new hook for pre mpm phase
Posted by Cody Sherr <cs...@covalent.net>.
The reason that the call to ap_run_pre_mpm is required in every
mpm is that it is replacing the call to ap_create_scoreboard.
ap_create_scoreboard gets called by the hook instead, and other functions
can be registered to executed in relation to the create_scoreboard call.
regards,
--
Cody Sherr
Engineer
Covalent Technologies
phone: (415)536-5292
email: csherr@covalent.net
On Mon, 16 Jul 2001 rbb@covalent.net wrote:
> On Mon, 16 Jul 2001, Ian Holsman wrote:
>
> > Cody Sherr wrote:
> >
> > >This patch creates a new hook, pre_mpm. ap_create_scoreboard is moved to a
> > >function registered with the pre_mpm hook.
> > >
> > >This allows modules like mod_snmp and others to register further functions
> > >to be run in relation to the creation of the scoreboard, and before mpm.
> > >
> > couldn't you put the 'ap_run_pre_mpm' inside of the scoreboard code??
> > so that at the end of the scoreboard creation it will be called (and
> > then change the name to ap_run_post_scoreboard)
> >
> > that way you won't have to put the hook in EVERY mpm,
>
> That would limit the usefulness of the hook. It would mean that functions
> registered for the hook could only run AFTER the core had created the
> scoreboard. The big use for something like this would actually be
> management modules. The same hook is called at startup and at server
> restart.
>
> It would make sense to me to have a management module scan the scoreboard
> at restart to gather some statistics to report. The obvious place to do
> stuff like this, is in the create_scoreboard hook.
>
> Ryan
>
> _____________________________________________________________________________
> Ryan Bloom rbb@apache.org
> Covalent Technologies rbb@covalent.net
> -----------------------------------------------------------------------------
>
>
>
Re: new hook for pre mpm phase
Posted by rb...@covalent.net.
On Mon, 16 Jul 2001, Ian Holsman wrote:
> Cody Sherr wrote:
>
> >This patch creates a new hook, pre_mpm. ap_create_scoreboard is moved to a
> >function registered with the pre_mpm hook.
> >
> >This allows modules like mod_snmp and others to register further functions
> >to be run in relation to the creation of the scoreboard, and before mpm.
> >
> couldn't you put the 'ap_run_pre_mpm' inside of the scoreboard code??
> so that at the end of the scoreboard creation it will be called (and
> then change the name to ap_run_post_scoreboard)
>
> that way you won't have to put the hook in EVERY mpm,
That would limit the usefulness of the hook. It would mean that functions
registered for the hook could only run AFTER the core had created the
scoreboard. The big use for something like this would actually be
management modules. The same hook is called at startup and at server
restart.
It would make sense to me to have a management module scan the scoreboard
at restart to gather some statistics to report. The obvious place to do
stuff like this, is in the create_scoreboard hook.
Ryan
_____________________________________________________________________________
Ryan Bloom rbb@apache.org
Covalent Technologies rbb@covalent.net
-----------------------------------------------------------------------------
Re: new hook for pre mpm phase
Posted by Ian Holsman <ia...@cnet.com>.
Cody Sherr wrote:
>This patch creates a new hook, pre_mpm. ap_create_scoreboard is moved to a
>function registered with the pre_mpm hook.
>
>This allows modules like mod_snmp and others to register further functions
>to be run in relation to the creation of the scoreboard, and before mpm.
>
couldn't you put the 'ap_run_pre_mpm' inside of the scoreboard code??
so that at the end of the scoreboard creation it will be called (and
then change the name to ap_run_post_scoreboard)
that way you won't have to put the hook in EVERY mpm,