On Fri, Sep 25, 2009 at 7:59 AM <[email protected]> wrote: > > Author: jim > Date: Fri Sep 25 11:59:30 2009 > New Revision: 818825 > > URL: http://svn.apache.org/viewvc?rev=818825&view=rev > Log: > Enhance ap_hook_monitor to pass along a server_rec (in > general the ap_server_conf) and tuck away some storage > in there which may be useful as an opaque data pointer. > > Modified: > httpd/httpd/trunk/include/ap_mmn.h > httpd/httpd/trunk/include/httpd.h > httpd/httpd/trunk/include/mpm_common.h > httpd/httpd/trunk/modules/examples/mod_example_hooks.c > httpd/httpd/trunk/modules/experimental/mod_noloris.c > httpd/httpd/trunk/modules/session/mod_session_dbd.c > httpd/httpd/trunk/server/mpm/event/event.c > httpd/httpd/trunk/server/mpm/prefork/prefork.c > httpd/httpd/trunk/server/mpm/worker/worker.c > httpd/httpd/trunk/server/mpm_common.c > > Modified: httpd/httpd/trunk/include/ap_mmn.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/ap_mmn.h (original) > +++ httpd/httpd/trunk/include/ap_mmn.h Fri Sep 25 11:59:30 2009 > @@ -196,6 +196,8 @@ > * 20090401.1 (2.3.3-dev) Protected log.c internals, http_log.h changes > * 20090401.2 (2.3.3-dev) Added tmp_flush_bb to core_output_filter_ctx_t > * 20090401.3 (2.3.3-dev) Added DAV options provider to mod_dav.h > + * 20090925.0 (2.3.3-dev) Added server_rec::context and added *server_rec > + * param to ap_wait_or_timeout() > * > */ > > > Modified: httpd/httpd/trunk/include/httpd.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/httpd.h (original) > +++ httpd/httpd/trunk/include/httpd.h Fri Sep 25 11:59:30 2009 > @@ -1235,6 +1235,9 @@ > > /** The server request scheme for redirect responses */ > const char *server_scheme; > + > + /** Opaque storage location */ > + void *context; > }; > > typedef struct core_output_filter_ctx { > > Modified: httpd/httpd/trunk/include/mpm_common.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/mpm_common.h?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/mpm_common.h (original) > +++ httpd/httpd/trunk/include/mpm_common.h Fri Sep 25 11:59:30 2009 > @@ -145,9 +145,10 @@ > * @param status The return code if a process has died > * @param ret The process id of the process that died > * @param p The pool to allocate out of > + * @param s The server_rec to pass > */ > void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t > *ret, > - apr_pool_t *p); > + apr_pool_t *p, server_rec *s); > > /** > * Log why a child died to the error log, if the child died without the > > Modified: httpd/httpd/trunk/modules/examples/mod_example_hooks.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/examples/mod_example_hooks.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/modules/examples/mod_example_hooks.c (original) > +++ httpd/httpd/trunk/modules/examples/mod_example_hooks.c Fri Sep 25 > 11:59:30 2009 > @@ -1399,7 +1399,7 @@ > * > * This is a RUN_ALL hook. > */ > -static int x_monitor(apr_pool_t *p) > +static int x_monitor(apr_pool_t *p, server_rec *s) > { > trace_nocontext(p, __FILE__, __LINE__, "x_monitor()"); > return DECLINED; > > Modified: httpd/httpd/trunk/modules/experimental/mod_noloris.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/experimental/mod_noloris.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/modules/experimental/mod_noloris.c (original) > +++ httpd/httpd/trunk/modules/experimental/mod_noloris.c Fri Sep 25 11:59:30 > 2009 > @@ -98,7 +98,7 @@ > > return DECLINED; > } > -static int noloris_monitor(apr_pool_t *pool) > +static int noloris_monitor(apr_pool_t *pool, server_rec *s) > { > static apr_hash_t *connections = NULL; > static apr_time_t last_check = 0; > > Modified: httpd/httpd/trunk/modules/session/mod_session_dbd.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/modules/session/mod_session_dbd.c (original) > +++ httpd/httpd/trunk/modules/session/mod_session_dbd.c Fri Sep 25 11:59:30 > 2009 > @@ -379,7 +379,7 @@ > * The monitor hook doesn't help us that much, as we have no handle into the > * server, and so we need to come up with a way to do this safely. > */ > -static apr_status_t dbd_clean(apr_pool_t *p) > +static apr_status_t dbd_clean(apr_pool_t *p, server_rec *s) > { > > return APR_ENOTIMPL; > @@ -471,10 +471,10 @@ > * This function performs housekeeping on the database, deleting expired > * sessions. > */ > -static int session_dbd_monitor(apr_pool_t *p) > +static int session_dbd_monitor(apr_pool_t *p, server_rec *s) > { > /* TODO handle housekeeping */ > - dbd_clean(p); > + dbd_clean(p, s); > return OK; > } > > > Modified: httpd/httpd/trunk/server/mpm/event/event.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/server/mpm/event/event.c (original) > +++ httpd/httpd/trunk/server/mpm/event/event.c Fri Sep 25 11:59:30 2009 > @@ -2109,7 +2109,7 @@ > int i; > > while (!restart_pending && !shutdown_pending) { > - ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); > + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf, ap_server_conf); > > if (pid.pid != -1) { > processed_status = ap_process_child_status(&pid, exitwhy, > status); > > Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original) > +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Fri Sep 25 11:59:30 2009 > @@ -1002,7 +1002,7 @@ > /* this is a memory leak, but I'll fix it later. */ > apr_proc_t pid; > > - ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); > + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf, ap_server_conf); > > /* XXX: if it takes longer than 1 second for all our children > * to start up and get into IDLE state then we may spawn an > > Modified: httpd/httpd/trunk/server/mpm/worker/worker.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/server/mpm/worker/worker.c (original) > +++ httpd/httpd/trunk/server/mpm/worker/worker.c Fri Sep 25 11:59:30 2009 > @@ -1604,7 +1604,7 @@ > int i; > > while (!restart_pending && !shutdown_pending) { > - ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); > + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf, ap_server_conf); > > if (pid.pid != -1) { > processed_status = ap_process_child_status(&pid, exitwhy, > status); > > Modified: httpd/httpd/trunk/server/mpm_common.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=818825&r1=818824&r2=818825&view=diff > ============================================================================== > --- httpd/httpd/trunk/server/mpm_common.c (original) > +++ httpd/httpd/trunk/server/mpm_common.c Fri Sep 25 11:59:30 2009 > @@ -108,14 +108,14 @@ > static int wait_or_timeout_counter; > > void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t > *ret, > - apr_pool_t *p) > + apr_pool_t *p, server_rec *s) > { > apr_status_t rv; > > ++wait_or_timeout_counter; > if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { > wait_or_timeout_counter = 0; > - ap_run_monitor(p); > + ap_run_monitor(p, s); > } > > rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p); > >
Sorry for the necromancy, but do you recall what the intent of the s->context was? I understand passing the server_rec, but the context isn't initialized or used, and no module could take claim to it. I was tempted to start using it for a private struct instead of adding more vhost.c-only garbage to the server_rec itself. Was that the idea? -- Eric Covener [email protected]
