]> granicus.if.org Git - apache/commitdiff
Provide apr_pool_t arg to register_hooks, since anything they do in that
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 17 Jan 2001 22:04:45 +0000 (22:04 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 17 Jan 2001 22:04:45 +0000 (22:04 +0000)
  step -must- be done with a pool that will not outlive the cmd pool, from
  which they may have been dynamically loaded.

  This needs further review, it's committed only as a stopgap for those
  who's builds I broke, sorry.  Review tbc late this evening.

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

include/http_config.h
modules/http/http_core.c
modules/mappers/mod_so.c
server/config.c
server/main.c

index 67c063efd969d543dda40f3b228775c02cbe4890..f16cb3c5dabfd7ee934acc2cc9a395fc5e4dc18e 100644 (file)
@@ -529,10 +529,12 @@ AP_DECLARE(const char *) ap_server_root_relative(apr_pool_t *p, const char *fnam
 
 /**
  * Add a module to the server
- * @param m the module structure of the module to add
- * @deffunc void ap_add_module(module *m)
+ * @param m The module structure of the module to add
+ * @param p The pool of the same lifetime as the module
+ * @deffunc void ap_add_module(module *m, apr_pool_t *p)
  */
-AP_DECLARE(void) ap_add_module(module *m);
+AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p);
+
 /**
  * Remove a module from the server.  There are some caveats:
  * when the module is removed, its slot is lost so all the current
@@ -545,10 +547,11 @@ AP_DECLARE(void) ap_add_module(module *m);
 AP_DECLARE(void) ap_remove_module(module *m);
 /**
  * Add a module to the chained modules list and the list of loaded modules
- * @param m the module structure of the module to add
- * @deffunc void ap_add_loaded_module(module *m)
+ * @param m The module structure of the module to add
+ * @param p The pool with the same lifetime as the module
+ * @deffunc void ap_add_loaded_module(module *m, apr_pool_t *p)
  */
-AP_DECLARE(void) ap_add_loaded_module(module *mod);
+AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p);
 /**
  * Remove a module fromthe chained modules list and the list of loaded modules
  * @param m the module structure of the module to remove
@@ -559,15 +562,17 @@ AP_DECLARE(void) ap_remove_loaded_module(module *mod);
  * Add a module to the list of loaded module based on the name of the
  * module
  * @param name The name of the module
+ * @param p The pool valid for the lifetime of the module
  * @return 1 on success, 0 on failure
- * @deffunc int ap_add_named_module(const char *name)
+ * @deffunc int ap_add_named_module(const char *name, apr_pool_t *p)
  */
-AP_DECLARE(int) ap_add_named_module(const char *name);
+AP_DECLARE(int) ap_add_named_module(const char *name, apr_pool_t *p);
 /**
  * Clear all of the modules from the loaded module list 
- * @deffunc void ap_add_named_module(void)
+ * @param p The pool valid for the lifetime of the modules
+ * @deffunc void ap_add_named_module(apr_pool_t *p)
  */
-AP_DECLARE(void) ap_clear_module_list(void);
+AP_DECLARE(void) ap_clear_module_list(apr_pool_t *p);
 /**
  * Find the name of the specified module
  * @param m The module to get the name for
@@ -800,9 +805,10 @@ AP_DECLARE(void) ap_run_rewrite_args(process_rec *process);
 /**
  * Run the register hooks function for a specified module
  * @param m The module to run the register hooks function fo
- * @deffunc void ap_register_hooks(module *m)
+ * @param p The pool valid for the lifetime of the module
+ * @deffunc void ap_register_hooks(module *m, apr_pool_t *p)
  */
-AP_DECLARE(void) ap_register_hooks(module *m);
+AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
 
 /**
  * Setup all virtual hosts
index f14cdf1eae2d23007400eb9608674324ef3ea64d..ce4a1a33e3f9adf11d6b2e9fbf1225e88ed326bd 100644 (file)
@@ -1903,7 +1903,7 @@ static const char *add_module_command(cmd_parms *cmd, void *dummy,
         return err;
     }
 
-    if (!ap_add_named_module(arg)) {
+    if (!ap_add_named_module(arg, cmd->pool)) {
        return apr_pstrcat(cmd->pool, "Cannot add module via name '", arg, 
                          "': not in list of loaded modules", NULL);
     }
@@ -1918,7 +1918,7 @@ static const char *clear_module_list_command(cmd_parms *cmd, void *dummy)
         return err;
     }
 
-    ap_clear_module_list();
+    ap_clear_module_list(cmd->pool);
     *(ap_directive_t **)dummy = NULL;
     return NULL;
 }
index ea012f9bac287e7d85c5ccda9feec574265ac430..9525928fd32e0c19286742b3bf7e128f02ebf986 100644 (file)
@@ -298,7 +298,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
     /* 
      * Add this module to the Apache core structures
      */
-    ap_add_loaded_module(modp);
+    ap_add_loaded_module(modp, cmd->pool);
 
     /* 
      * Register a cleanup in the config apr_pool_t (normally pconf). When
index 8b1f579a40b101da08d20b3bf1986f18d796d987..16ab1da62f6b77933998dd9855aff3d1bada24e8 100644 (file)
@@ -338,23 +338,23 @@ AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method) {
     return 0;
 }
 
-AP_DECLARE(void) ap_register_hooks(module *m)
-    {
+AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p)
+{
     if(m->register_hooks)
-       {
+    {
        if(getenv("SHOW_HOOKS"))
-           {
+       {
            printf("Registering hooks for %s\n",m->name);
            ap_debug_module_hooks=1;
-           }
-       ap_current_hooking_module=m->name;
-       m->register_hooks();
        }
+       ap_current_hooking_module=m->name;
+       m->register_hooks(p);
     }
+}
 
 /* One-time setup for precompiled modules --- NOT to be done on restart */
 
-AP_DECLARE(void) ap_add_module(module *m)
+AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p)
 {
     /* This could be called from an AddModule httpd.conf command,
      * after the file has been linked and the module structure within it
@@ -407,8 +407,10 @@ AP_DECLARE(void) ap_add_module(module *m)
     }
 #endif /*_OSD_POSIX*/
 
-    /* FIXME: is this the right place to call this? */
-    ap_register_hooks(m);
+    /*  FIXME: is this the right place to call this?
+     *  It doesn't appear to be
+     */
+    ap_register_hooks(m, p);
 }
 
 /* 
@@ -454,14 +456,14 @@ AP_DECLARE(void) ap_remove_module(module *m)
     total_modules--;
 }
 
-AP_DECLARE(void) ap_add_loaded_module(module *mod)
+AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p)
 {
     module **m;
 
     /* 
      *  Add module pointer to top of chained module list 
      */
-    ap_add_module(mod);
+    ap_add_module(mod, p);
 
     /* 
      *  And module pointer to list of loaded modules 
@@ -537,7 +539,7 @@ AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process)
      *   Initialize chain of linked (=activate) modules
      */
     for (m = ap_prelinked_modules; *m != NULL; m++)
-        ap_add_module(*m);
+        ap_add_module(*m, process->pconf);
 
     ap_sort_hooks();
 }
@@ -559,7 +561,7 @@ AP_DECLARE(module *) ap_find_linked_module(const char *name)
 }
 
 /* Add a named module.  Returns 1 if module found, 0 otherwise.  */
-AP_DECLARE(int) ap_add_named_module(const char *name)
+AP_DECLARE(int) ap_add_named_module(const char *name, apr_pool_t *p)
 {
     module *modp;
     int i = 0;
@@ -568,7 +570,7 @@ AP_DECLARE(int) ap_add_named_module(const char *name)
        if (strcmp(modp->name, name) == 0) {
            /* Only add modules that are not already enabled.  */
            if (modp->next == NULL) {
-               ap_add_module(modp);
+               ap_add_module(modp, p);
            }
            return 1;
        }
@@ -578,7 +580,7 @@ AP_DECLARE(int) ap_add_named_module(const char *name)
 }
 
 /* Clear the internal list of modules, in preparation for starting over. */
-AP_DECLARE(void) ap_clear_module_list()
+AP_DECLARE(void) ap_clear_module_list(apr_pool_t *p)
 {
     module **m = &top_module;
     module **next_m;
@@ -590,7 +592,7 @@ AP_DECLARE(void) ap_clear_module_list()
     }
 
     /* This is required; so we add it always.  */
-    ap_add_named_module("http_core.c");
+    ap_add_named_module("http_core.c", p);
 }
 
 /*****************************************************************
index 25eca86492f87867bf374d6580496631e0639689..b7967c90271e109aefe5965c775e52d73bbdb674 100644 (file)
@@ -404,7 +404,7 @@ int main(int argc, const char * const argv[])
        ap_hook_deregister_all();
        apr_clear_pool(pconf);
        for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
-               ap_register_hooks(*mod);
+               ap_register_hooks(*mod, pconf);
        }
         /* This is a hack until we finish the code so that it only reads
          * the config file once and just operates on the tree already in