]> granicus.if.org Git - apache/commitdiff
Enhance ap_hook_monitor to pass along a server_rec (in
authorJim Jagielski <jim@apache.org>
Fri, 25 Sep 2009 11:59:30 +0000 (11:59 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 25 Sep 2009 11:59:30 +0000 (11:59 +0000)
general the ap_server_conf) and tuck away some storage
in there which may be useful as an opaque data pointer.

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

include/ap_mmn.h
include/httpd.h
include/mpm_common.h
modules/examples/mod_example_hooks.c
modules/experimental/mod_noloris.c
modules/session/mod_session_dbd.c
server/mpm/event/event.c
server/mpm/prefork/prefork.c
server/mpm/worker/worker.c
server/mpm_common.c

index eeec6af8d8cb5b34775d3eb08b7388c650862d40..d505475dfa87dd69740a61e5937a71da0e665281 100644 (file)
  * 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()
  *
  */
 
index cd47b11132c70e22762589b552fd7467f73a49fb..c5c332e8200fb260c8f716784f9e1dbf57416f2d 100644 (file)
@@ -1235,6 +1235,9 @@ struct server_rec {
 
     /** The server request scheme for redirect responses */
     const char *server_scheme;
+
+    /** Opaque storage location */
+    void *context;
 };
 
 typedef struct core_output_filter_ctx {
index 0e8143b5c38b7b6143c2083e2d4bf27ab781cab2..1ce3abb5c0e85d25e29f0da846c2f46755dc7a4a 100644 (file)
@@ -145,9 +145,10 @@ apr_status_t ap_mpm_safe_kill(pid_t pid, int sig);
  * @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
index 30ea60fe781631def056050b7db1dc3571c13b5f..f6b997932967f0e260570b320b261b8095237b03 100644 (file)
@@ -1399,7 +1399,7 @@ static int x_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
  * 
  * 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;
index 6baa8933bdf9b76e3b6578c5d0e64fb7de0a8bb8..75bb9115db81072595dbbc6f2b8d72859f99887e 100644 (file)
@@ -98,7 +98,7 @@ static int noloris_conn(conn_rec *conn)
 
     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;
index 7df10cd82d6c418c693ffcf57252491924c8f3f0..83aceb8776579f3b207c3b685beef4ee3ba71bab 100644 (file)
@@ -379,7 +379,7 @@ static apr_status_t dbd_remove(request_rec * r, const char *key)
  * 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 @@ static int session_dbd_save(request_rec * r, session_rec * z)
  * 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;
 }
 
index cb5c9427a515eaa9f011212851df6abae73b9756..3cacb23dcf29a6b1298f2eeeb69f29bb05b81275 100644 (file)
@@ -2109,7 +2109,7 @@ static void server_main_loop(int remaining_children_to_start)
     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);
index 9b30635fc831ae90856c1c801302fc3af10ff90f..91d8ae81bbd104dd64c3d464e0bac2951a90d085 100644 (file)
@@ -1002,7 +1002,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         /* 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
index 92b26fe45586cd5e1425e4938ea097762417f8b6..aa397475a12f8298c7347a8968f1f0420c9d5c9b 100644 (file)
@@ -1604,7 +1604,7 @@ static void server_main_loop(int remaining_children_to_start)
     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);
index 6988374d015271e0725ab87ac65b5b8a9b266a65..65fff4e354871e8b8b27059b29dc23dd40bde08c 100644 (file)
@@ -108,14 +108,14 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(const char *, mpm_get_name,
 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);