httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r758224 - in /httpd/httpd/trunk/server/mpm/simple: simple_api.c simple_core.c simple_types.h
Date Wed, 25 Mar 2009 11:23:33 GMT
Author: trawick
Date: Wed Mar 25 11:23:29 2009
New Revision: 758224

URL: http://svn.apache.org/viewvc?rev=758224&view=rev
Log:
change the allocation path for the simple MPM's retained data, as a dynamically
loadable MPM can't use the rewrite-args hook

(note across the table: the hooker hook has no retcode feedback, so I didn't init
the data there)

Modified:
    httpd/httpd/trunk/server/mpm/simple/simple_api.c
    httpd/httpd/trunk/server/mpm/simple/simple_core.c
    httpd/httpd/trunk/server/mpm/simple/simple_types.h

Modified: httpd/httpd/trunk/server/mpm/simple/simple_api.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_api.c?rev=758224&r1=758223&r2=758224&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/simple/simple_api.c (original)
+++ httpd/httpd/trunk/server/mpm/simple/simple_api.c Wed Mar 25 11:23:29 2009
@@ -131,7 +131,18 @@
 {
     int run_debug;
     apr_status_t rv;
-    simple_core_t *sc = simple_core_get();
+    simple_core_t *sc;
+
+    /* this is our first 'real' entry point, so setup everything here. */
+    rv = simple_core_init_once();
+
+    if (rv) {
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                     "simple_core_init_once: Fatal Error Encountered");
+        return HTTP_INTERNAL_SERVER_ERROR;
+    }
+
+    sc = simple_core_get();
 
     sc->restart_num++;
 
@@ -165,22 +176,6 @@
     return OK;
 }
 
-static void simple_process_start(process_rec * process)
-{
-    apr_status_t rv;
-
-    /* this is our first 'real' entry point, so setup everything here. */
-    rv = simple_core_init(simple_core_get(), process->pool);
-
-    if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
-                     "simple_core_init: Fatal Error Encountered");
-        exit(EXIT_FAILURE);
-    }
-
-    ap_mpm_rewrite_args(process);
-}
-
 static int
 simple_check_config(apr_pool_t * p, apr_pool_t * plog,
                     apr_pool_t * ptemp, server_rec * s)
@@ -275,7 +270,7 @@
 
 module AP_MODULE_DECLARE_DATA mpm_simple_module = {
     MPM20_MODULE_STUFF,
-    simple_process_start,       /* hook to run before apache parses args */
+    ap_mpm_rewrite_args,        /* hook to run before apache parses args */
     NULL,                       /* create per-directory config structure */
     NULL,                       /* merge per-directory config structures */
     NULL,                       /* create per-server config structure */

Modified: httpd/httpd/trunk/server/mpm/simple/simple_core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_core.c?rev=758224&r1=758223&r2=758224&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/simple/simple_core.c (original)
+++ httpd/httpd/trunk/server/mpm/simple/simple_core.c Wed Mar 25 11:23:29 2009
@@ -21,8 +21,10 @@
 #include "ap_mpm.h"
 #include "httpd.h"
 #include "http_log.h"
+#include "http_config.h"
+#include "http_main.h"
 
-static simple_core_t g_simple_core;
+static simple_core_t *g_simple_core;
 
 #ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
 #define DEFAULT_MAX_REQUESTS_PER_CHILD 0
@@ -31,16 +33,23 @@
 
 simple_core_t *simple_core_get()
 {
-    return &g_simple_core;
+    return g_simple_core;
 }
 
-apr_status_t simple_core_init(simple_core_t * sc, apr_pool_t * pool)
+apr_status_t simple_core_init_once(void)
 {
     apr_status_t rv;
+    const char *userdata_key = "mpm_simple_module";
+    simple_core_t *sc;
 
-    memset(sc, 0, sizeof(simple_core_t));
+    g_simple_core = ap_get_retained_data(userdata_key);
+    if (g_simple_core) {
+        return APR_SUCCESS;
+    }
+    
+    sc = g_simple_core = ap_set_retained_data(userdata_key, sizeof(*g_simple_core));
 
-    apr_pool_create(&sc->pool, pool);
+    apr_pool_create(&sc->pool, ap_pglobal);
 
     apr_pool_tag(sc->pool, "simple-mpm-core");
 
@@ -59,7 +68,7 @@
 
     if (rv) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
-                     "simple_core_init: apr_thread_mutex_create failed.");
+                     "simple_core_init_once: apr_thread_mutex_create failed.");
         return rv;
     }
 

Modified: httpd/httpd/trunk/server/mpm/simple/simple_types.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_types.h?rev=758224&r1=758223&r2=758224&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/simple/simple_types.h (original)
+++ httpd/httpd/trunk/server/mpm/simple/simple_types.h Wed Mar 25 11:23:29 2009
@@ -126,7 +126,7 @@
 
 simple_core_t *simple_core_get(void);
 
-/* Resets all variables to 0 for a simple_core_t */
-apr_status_t simple_core_init(simple_core_t * sc, apr_pool_t * pool);
+/* Allocates/initializes data retained over the life of the process */
+apr_status_t simple_core_init_once(void);
 
 #endif /* APACHE_MPM_SIMPLE_TYPES_H */



Mime
View raw message