httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r816191 - in /httpd/mod_fcgid/trunk/modules/fcgid: fcgid_bridge.c fcgid_conf.c fcgid_conf.h fcgid_filter.c fcgid_pm_main.c fcgid_pm_unix.c fcgid_pm_win.c fcgid_proc_unix.c fcgid_proctbl_unix.c fcgid_spawn_ctl.c fcgid_spawn_ctl.h mod_fcgid.c
Date Thu, 17 Sep 2009 13:56:24 GMT
Author: trawick
Date: Thu Sep 17 13:56:23 2009
New Revision: 816191

URL: http://svn.apache.org/viewvc?rev=816191&view=rev
Log:
obtain configuration values from the server config instead
of calling accessor functions and storing the result in
global variables

Modified:
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.h
    httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Thu Sep 17 13:56:23 2009
@@ -160,7 +160,8 @@
      */
     fcgid_bucket_ctx *ctx = (fcgid_bucket_ctx *) thectx;
     server_rec *s = ctx->ipc.request->server;
-    int max_requests_per_process = get_max_requests_per_process(s);
+    fcgid_server_conf *sconf = ap_get_module_config(s->module_config,
+                                                    &fcgid_module);
 
     /* Free bucket buffer */
     if (ctx->buffer) {
@@ -173,7 +174,7 @@
     if (ctx->procnode) {
         /* Return procnode
            I will return this slot to idle(or error) list except:
-           I take too much time on this request( greater than get_busy_timeout() ),
+           I take too much time on this request( greater than BusyTimeout) ),
            so the process manager may have put this slot from busy list to error
            list, and the contain of this slot may have been modified
            In this case I will do nothing and return, let the process manager 
@@ -181,7 +182,7 @@
          */
         int dt = (int)
             (apr_time_sec(apr_time_now()) - apr_time_sec(ctx->active_time));
-        if (dt > get_busy_timeout(s)) {
+        if (dt > sconf->busy_timeout) {
             /* Do nothing but print log */
             ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
                          "mod_fcgid: process busy timeout, took %d seconds for this request",
@@ -190,9 +191,9 @@
             ctx->procnode->diewhy = FCGID_DIE_COMM_ERROR;
             return_procnode(s, ctx->procnode,
                             1 /* communication error */ );
-        } else if (max_requests_per_process != -1
+        } else if (sconf->max_requests_per_process != -1
                    && ++ctx->procnode->requests_handled >=
-                   max_requests_per_process) {
+                   sconf->max_requests_per_process) {
             ctx->procnode->diewhy = FCGID_DIE_LIFETIME_EXPIRED;
             return_procnode(s, ctx->procnode,
                             1 /* handled all requests */ );
@@ -288,6 +289,8 @@
 {
     apr_pool_t *request_pool = r->main ? r->main->pool : r->pool;
     server_rec *s = r->server;
+    fcgid_server_conf *sconf = ap_get_module_config(s->module_config,
+                                                    &fcgid_module);
     fcgid_command fcgi_request;
     fcgid_bucket_ctx *bucket_ctx;
     int i, j, cond_status;
@@ -297,8 +300,8 @@
     const char *location;
 
     bucket_ctx = apr_pcalloc(request_pool, sizeof(*bucket_ctx));
-    bucket_ctx->ipc.connect_timeout = get_ipc_connect_timeout(r->server);
-    bucket_ctx->ipc.communation_timeout = get_ipc_comm_timeout(r->server);
+    bucket_ctx->ipc.connect_timeout = sconf->ipc_connect_timeout;
+    bucket_ctx->ipc.communation_timeout = sconf->ipc_comm_timeout;
 
     bucket_ctx->ipc.request = r;
     apr_pool_cleanup_register(request_pool, bucket_ctx,
@@ -434,6 +437,8 @@
 {
     apr_pool_t *request_pool = r->main ? r->main->pool : r->pool;
     server_rec *s = r->server;
+    fcgid_server_conf *sconf = ap_get_module_config(s->module_config,
+                                                    &fcgid_module);
     apr_status_t rv = APR_SUCCESS;
     int seen_eos;
     size_t request_size = 0;
@@ -443,8 +448,6 @@
     FCGI_Header *stdin_request_header;
     apr_bucket_brigade *output_brigade;
     apr_bucket *bucket_input, *bucket_header, *bucket_eos;
-    size_t max_request_len = get_max_request_len(s);
-    size_t max_mem_request_len = get_max_mem_request_len(s);
     char **envp = ap_create_environment(request_pool,
                                         r->subprocess_env);
 
@@ -523,14 +526,14 @@
                                        r->connection->bucket_alloc);
 
             request_size += len;
-            if (request_size > max_request_len) {
+            if (request_size > sconf->max_request_len) {
                 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
                              "mod_fcgid: http request length %" APR_SIZE_T_FMT " > %"
APR_SIZE_T_FMT,
-                             request_size, max_request_len);
+                             request_size, sconf->max_request_len);
                 return HTTP_INTERNAL_SERVER_ERROR;
             }
 
-            if (request_size > max_mem_request_len) {
+            if (request_size > sconf->max_mem_request_len) {
                 apr_size_t wrote_len;
                 static const char *fd_key = "fcgid_fd";
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Thu Sep 17 13:56:23 2009
@@ -175,13 +175,6 @@
     return NULL;
 }
 
-int get_idle_timeout(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->idle_timeout : DEFAULT_IDLE_TIMEOUT;
-}
-
 const char *set_idle_scan_interval(cmd_parms * cmd, void *dummy,
                                    const char *arg)
 {
@@ -198,13 +191,6 @@
     return NULL;
 }
 
-int get_idle_scan_interval(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->idle_scan_interval : DEFAULT_IDLE_TIMEOUT;
-}
-
 const char *set_busy_timeout(cmd_parms * cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -215,13 +201,6 @@
     return NULL;
 }
 
-int get_busy_timeout(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->busy_timeout : DEFAULT_BUSY_TIMEOUT;
-}
-
 const char *set_busy_scan_interval(cmd_parms * cmd, void *dummy,
                                    const char *arg)
 {
@@ -238,14 +217,6 @@
     return NULL;
 }
 
-int get_busy_scan_interval(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        busy_scan_interval : DEFAULT_BUSY_SCAN_INTERVAL;
-}
-
 const char *set_proc_lifetime(cmd_parms * cmd, void *dummy,
                               const char *arg)
 {
@@ -262,13 +233,6 @@
     return NULL;
 }
 
-int get_proc_lifetime(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->proc_lifetime : DEFAULT_PROC_LIFETIME;
-}
-
 const char *set_error_scan_interval(cmd_parms * cmd, void *dummy,
                                     const char *arg)
 {
@@ -285,14 +249,6 @@
     return NULL;
 }
 
-int get_error_scan_interval(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        error_scan_interval : DEFAULT_ERROR_SCAN_INTERVAL;
-}
-
 const char *set_zombie_scan_interval(cmd_parms * cmd, void *dummy,
                                      const char *arg)
 {
@@ -309,14 +265,6 @@
     return NULL;
 }
 
-int get_zombie_scan_interval(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        zombie_scan_interval : DEFAULT_ZOMBIE_SCAN_INTERVAL;
-}
-
 const char *set_socketpath(cmd_parms * cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -335,13 +283,6 @@
     return NULL;
 }
 
-const char *get_socketpath(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config->sockname_prefix;
-}
-
 const char *set_shmpath(cmd_parms * cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -360,13 +301,6 @@
     return NULL;
 }
 
-const char *get_shmpath(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config->shmname_path;
-}
-
 const char *set_spawnscore_uplimit(cmd_parms * cmd, void *dummy,
                                    const char *arg)
 {
@@ -383,14 +317,6 @@
     return NULL;
 }
 
-int get_spawnscore_uplimit(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        spawnscore_uplimit : DEFAULT_SPAWNSOCRE_UPLIMIT;
-}
-
 const char *set_max_request_len(cmd_parms * cmd, void *dummy,
                                 const char *arg)
 {
@@ -402,13 +328,6 @@
     return NULL;
 }
 
-int get_max_request_len(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->max_request_len : DEFAULT_MAX_REQUEST_LEN;
-}
-
 const char *set_max_mem_request_len(cmd_parms * cmd, void *dummy,
                                     const char *arg)
 {
@@ -420,14 +339,6 @@
     return NULL;
 }
 
-int get_max_mem_request_len(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        max_mem_request_len : DEFAULT_MAX_MEM_REQUEST_LEN;
-}
-
 const char *set_spawn_score(cmd_parms * cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -443,13 +354,6 @@
     return NULL;
 }
 
-int get_spawn_score(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->spawn_score : DEFAULT_SPAWN_SCORE;
-}
-
 const char *set_time_score(cmd_parms * cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -465,13 +369,6 @@
     return NULL;
 }
 
-int get_time_score(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->time_score : DEFAULT_TIME_SCORE;
-}
-
 const char *set_termination_score(cmd_parms * cmd, void *dummy,
                                   const char *arg)
 {
@@ -488,13 +385,6 @@
     return NULL;
 }
 
-int get_termination_score(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->termination_score : DEFAULT_TERMINATION_SCORE;
-}
-
 const char *set_max_process(cmd_parms * cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -510,13 +400,6 @@
     return NULL;
 }
 
-int get_max_process(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->max_process_count : DEFAULT_MAX_PROCESS_COUNT;
-}
-
 const char *set_output_buffersize(cmd_parms * cmd, void *dummy,
                                   const char *arg)
 {
@@ -528,13 +411,6 @@
     return NULL;
 }
 
-int get_output_buffersize(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->output_buffersize : DEFAULT_OUTPUT_BUFFERSIZE;
-}
-
 const char *set_max_class_process(cmd_parms * cmd, void *dummy,
                                   const char *arg)
 {
@@ -551,14 +427,6 @@
     return NULL;
 }
 
-int get_max_class_process(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        max_class_process_count : DEFAULT_MAX_CLASS_PROCESS_COUNT;
-}
-
 const char *set_min_class_process(cmd_parms * cmd, void *dummy,
                                   const char *arg)
 {
@@ -575,14 +443,6 @@
     return NULL;
 }
 
-int get_min_class_process(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        min_class_process_count : DEFAULT_MIN_CLASS_PROCESS_COUNT;
-}
-
 const char *set_php_fix_pathinfo_enable(cmd_parms * cmd, void *dummy,
                                         const char *arg)
 {
@@ -610,21 +470,6 @@
     return NULL;
 }
 
-int get_max_requests_per_process(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        max_requests_per_process : DEFAULT_MAX_REQUESTS_PER_PROCESS;
-}
-
-int get_php_fix_pathinfo_enable(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->php_fix_pathinfo_enable : 0;
-}
-
 const char *set_ipc_connect_timeout(cmd_parms * cmd, void *dummy,
                                     const char *arg)
 {
@@ -636,14 +481,6 @@
     return NULL;
 }
 
-int get_ipc_connect_timeout(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->
-        ipc_connect_timeout : DEFAULT_IPC_CONNECT_TIMEOUT;
-}
-
 const char *set_ipc_comm_timeout(cmd_parms * cmd, void *dummy,
                                  const char *arg)
 {
@@ -658,13 +495,6 @@
     return NULL;
 }
 
-int get_ipc_comm_timeout(server_rec * s)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(s->module_config, &fcgid_module);
-    return config ? config->ipc_comm_timeout : DEFAULT_IPC_COMM_TIMEOUT;
-}
-
 const char *add_default_env_vars(cmd_parms * cmd, void *dummy,
                                  const char *name, const char *value)
 {

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h Thu Sep 17 13:56:23 2009
@@ -127,82 +127,61 @@
 
 const char *set_idle_timeout(cmd_parms * cmd, void *dummy,
                              const char *arg);
-int get_idle_timeout(server_rec * s);
 
 const char *set_idle_scan_interval(cmd_parms * cmd, void *dummy,
                                    const char *arg);
-int get_idle_scan_interval(server_rec * s);
 
 const char *set_busy_timeout(cmd_parms * cmd, void *dummy,
                              const char *arg);
-int get_busy_timeout(server_rec * s);
 
 const char *set_busy_scan_interval(cmd_parms * cmd, void *dummy,
                                    const char *arg);
-int get_busy_scan_interval(server_rec * s);
 
 const char *set_proc_lifetime(cmd_parms * cmd, void *dummy,
                               const char *arg);
-int get_proc_lifetime(server_rec * s);
 
 const char *set_error_scan_interval(cmd_parms * cmd, void *dummy,
                                     const char *arg);
-int get_error_scan_interval(server_rec * s);
 
 const char *set_zombie_scan_interval(cmd_parms * cmd, void *dummy,
                                      const char *arg);
-int get_zombie_scan_interval(server_rec * s);
 
 const char *set_socketpath(cmd_parms * cmd, void *dummy, const char *arg);
-const char *get_socketpath(server_rec * s);
 
 const char *set_shmpath(cmd_parms * cmd, void *dummy, const char *arg);
-const char *get_shmpath(server_rec * s);
 
 const char *set_time_score(cmd_parms * cmd, void *dummy, const char *arg);
-int get_time_score(server_rec * s);
 
 const char *set_max_request_len(cmd_parms * cmd, void *dummy,
                                 const char *arg);
-int get_max_request_len(server_rec * s);
 
 const char *set_max_mem_request_len(cmd_parms * cmd, void *dummy,
                                     const char *arg);
-int get_max_mem_request_len(server_rec * s);
 
 const char *set_termination_score(cmd_parms * cmd, void *dummy,
                                   const char *arg);
-int get_termination_score(server_rec * s);
 
 const char *set_spawn_score(cmd_parms * cmd, void *dummy, const char *arg);
-int get_spawn_score(server_rec * s);
 
 const char *set_spawnscore_uplimit(cmd_parms * cmd, void *dummy,
                                    const char *arg);
-int get_spawnscore_uplimit(server_rec * s);
 
 const char *set_max_process(cmd_parms * cmd, void *dummy, const char *arg);
-int get_max_process(server_rec * s);
 
 const char *set_max_class_process(cmd_parms * cmd, void *dummy,
                                   const char *arg);
-int get_max_class_process(server_rec * s);
 
 const char *set_min_class_process(cmd_parms * cmd, void *dummy,
                                   const char *arg);
-int get_min_class_process(server_rec * s);
 
 const char *set_ipc_connect_timeout(cmd_parms * cmd, void *dummy,
                                     const char *arg);
-int get_ipc_connect_timeout(server_rec * s);
 
 const char *set_ipc_comm_timeout(cmd_parms * cmd, void *dummy,
                                  const char *arg);
-int get_ipc_comm_timeout(server_rec * s);
 
 const char *set_output_buffersize(cmd_parms * cmd, void *dummy,
                                   const char *arg);
-int get_output_buffersize(server_rec * s);
 
 const char *add_default_env_vars(cmd_parms * cmd, void *sconf,
                                  const char *name, const char *value);
@@ -237,11 +216,11 @@
 
 const char *set_php_fix_pathinfo_enable(cmd_parms * cmd, void *dummy,
                                         const char *arg);
-int get_php_fix_pathinfo_enable(server_rec * s);
 
 const char *set_max_requests_per_process(cmd_parms * cmd, void *dummy,
                                          const char *arg);
-int get_max_requests_per_process(server_rec * s);
+
+AP_DECLARE_DATA extern module fcgid_module;
 
 #endif
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c Thu Sep 17 13:56:23 2009
@@ -29,7 +29,8 @@
     int save_size = 0;
     conn_rec *c = f->c;
     server_rec *s = f->r->server;
-    int buffsize = get_output_buffersize(s);
+    fcgid_server_conf *sconf = ap_get_module_config(s->module_config,
+                                                    &fcgid_module);
 
     tmp_brigade =
         apr_brigade_create(f->r->pool, f->r->connection->bucket_alloc);
@@ -68,7 +69,7 @@
         APR_BRIGADE_INSERT_TAIL(tmp_brigade, e);
 
         /* I will pass tmp_brigade to next filter if I have got too much buckets */
-        if (save_size > buffsize) {
+        if (save_size > sconf->output_buffersize) {
             APR_BRIGADE_INSERT_TAIL(tmp_brigade,
                                     apr_bucket_flush_create(f->r->
                                                             connection->

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c Thu Sep 17 13:56:23 2009
@@ -29,14 +29,6 @@
 
 #define HAS_GRACEFUL_KILL "Gracefulkill"
 
-static int g_idle_timeout;
-static int g_idle_scan_interval;
-static int g_busy_timeout;
-static int g_busy_scan_interval;
-static int g_proc_lifetime;
-static int g_error_scan_interval;
-static int g_zombie_scan_interval;
-
 static void
 link_node_to_list(server_rec * main_server,
                   fcgid_procnode * header,
@@ -61,11 +53,13 @@
     fcgid_procnode *proc_table;
     apr_time_t last_active_time, start_time;
     apr_time_t now = apr_time_now();
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     /* Should I check the idle list now? */
     if (procmgr_must_exit()
         || apr_time_sec(now) - apr_time_sec(lastidlescan) <=
-        g_idle_scan_interval)
+        sconf->idle_scan_interval)
         return;
     lastidlescan = now;
 
@@ -81,16 +75,16 @@
         last_active_time = current_node->last_active_time;
         start_time = current_node->start_time;
         if ((apr_time_sec(now) - apr_time_sec(last_active_time) >
-             g_idle_timeout
+             sconf->idle_timeout
              || apr_time_sec(now) - apr_time_sec(start_time) >
-             g_proc_lifetime)
-            && is_kill_allowed(current_node)) {
+             sconf->proc_lifetime)
+            && is_kill_allowed(main_server, current_node)) {
             /* Set die reason for log */
             if (apr_time_sec(now) - apr_time_sec(last_active_time) >
-                g_idle_timeout)
+                sconf->idle_timeout)
                 current_node->diewhy = FCGID_DIE_IDLE_TIMEOUT;
             else if (apr_time_sec(now) - apr_time_sec(start_time) >
-                     g_proc_lifetime)
+                     sconf->proc_lifetime)
                 current_node->diewhy = FCGID_DIE_LIFETIME_EXPIRED;
 
             /* Unlink from idle list */
@@ -119,11 +113,13 @@
     fcgid_procnode *proc_table;
     apr_time_t last_active_time;
     apr_time_t now = apr_time_now();
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     /* Should I check the busy list? */
     if (procmgr_must_exit()
         || apr_time_sec(now) - apr_time_sec(lastbusyscan) <=
-        g_busy_scan_interval)
+        sconf->busy_scan_interval)
         return;
     lastbusyscan = now;
 
@@ -139,7 +135,7 @@
 
         last_active_time = current_node->last_active_time;
         if (apr_time_sec(now) - apr_time_sec(last_active_time) >
-            g_busy_timeout) {
+            (sconf->busy_timeout + 10)) {
             /* Set dir reason for log */
             current_node->diewhy = FCGID_DIE_BUSY_TIMEOUT;
 
@@ -174,13 +170,15 @@
     apr_time_t last_active_time;
     apr_time_t now = apr_time_now();
     fcgid_procnode temp_header;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     memset(&temp_header, 0, sizeof(temp_header));
 
     /* Should I check zombie processes in idle list now? */
     if (procmgr_must_exit()
         || apr_time_sec(now) - apr_time_sec(lastzombiescan) <=
-        g_zombie_scan_interval)
+        sconf->zombie_scan_interval)
         return;
     lastzombiescan = now;
 
@@ -200,7 +198,7 @@
         /* Is it time for zombie check? */
         last_active_time = current_node->last_active_time;
         if (apr_time_sec(now) - apr_time_sec(last_active_time) >
-            g_zombie_scan_interval) {
+            sconf->zombie_scan_interval) {
             /* Unlink from idle list */
             previous_node->next_index = current_node->next_index;
 
@@ -277,11 +275,13 @@
     fcgid_procnode *free_list_header = proctable_get_free_list();
     fcgid_procnode *proc_table = proctable_get_table_array();
     fcgid_procnode temp_error_header;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     /* Should I check the busy list? */
     if (procmgr_must_exit()
         || apr_time_sec(now) - apr_time_sec(lasterrorscan) <=
-        g_error_scan_interval)
+        sconf->error_scan_interval)
         return;
     lasterrorscan = now = apr_time_now();
 
@@ -552,16 +552,6 @@
 {
     fcgid_command command;
 
-    /* Initialize the variables from configuration */
-    g_idle_timeout = get_idle_timeout(main_server);
-    g_idle_scan_interval = get_idle_scan_interval(main_server);
-    g_busy_scan_interval = get_busy_scan_interval(main_server);
-    g_proc_lifetime = get_proc_lifetime(main_server);
-    g_error_scan_interval = get_error_scan_interval(main_server);
-    g_zombie_scan_interval = get_zombie_scan_interval(main_server);
-    g_busy_timeout = get_busy_timeout(main_server);
-    g_busy_timeout += 10;
-
     while (1) {
         if (procmgr_must_exit())
             break;

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c Thu Sep 17 13:56:23 2009
@@ -305,28 +305,28 @@
 {
     apr_status_t rv;
     apr_finfo_t finfo;
-    int error_scan_interval, busy_scan_interval, idle_scan_interval;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     /* Calculate procmgr_peek_cmd wake up interval */
-    error_scan_interval = get_error_scan_interval(main_server);
-    busy_scan_interval = get_busy_scan_interval(main_server);
-    idle_scan_interval = get_idle_scan_interval(main_server);
-    g_wakeup_timeout = fcgid_min(error_scan_interval, busy_scan_interval);
-    g_wakeup_timeout = fcgid_min(idle_scan_interval, g_wakeup_timeout);
+    g_wakeup_timeout = fcgid_min(sconf->error_scan_interval, 
+                                 sconf->busy_scan_interval);
+    g_wakeup_timeout = fcgid_min(sconf->idle_scan_interval, 
+                                 g_wakeup_timeout);
     if (g_wakeup_timeout == 0)
         g_wakeup_timeout = 1;   /* Make it reasonable */
 
-    rv = apr_stat(&finfo, get_socketpath(main_server), APR_FINFO_USER,
+    rv = apr_stat(&finfo, sconf->sockname_prefix, APR_FINFO_USER,
                   configpool);
     if (rv != APR_SUCCESS) {
         /* Make dir for unix domain socket */
-        if ((rv = apr_dir_make_recursive(get_socketpath(main_server),
+        if ((rv = apr_dir_make_recursive(sconf->sockname_prefix,
                                          APR_UREAD | APR_UWRITE |
                                          APR_UEXECUTE,
                                          configpool)) != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_ERR, rv, main_server,
                          "mod_fcgid: Can't create unix socket dir %s",
-                         get_socketpath(main_server));
+                         sconf->sockname_prefix);
             exit(1);
         }
 
@@ -342,11 +342,11 @@
          */
 
         if (!geteuid()) {
-            if (chown(get_socketpath(main_server),
+            if (chown(sconf->sockname_prefix,
                       ap_unixd_config.user_id, -1) < 0) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
                              "mod_fcgid: Can't set ownership of unix socket dir %s",
-                             get_socketpath(main_server));
+                             sconf->sockname_prefix);
                 exit(1);
             }
         }

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c Thu Sep 17 13:56:23 2009
@@ -63,7 +63,8 @@
 procmgr_post_config(server_rec * main_server, apr_pool_t * pconf)
 {
     apr_status_t rv;
-    int error_scan_interval, busy_scan_interval, idle_scan_interval;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     /* Initialize spawn controler */
     spawn_control_init(main_server, pconf);
@@ -90,11 +91,10 @@
     }
 
     /* Calculate procmgr_peek_cmd wake up interval */
-    error_scan_interval = get_error_scan_interval(main_server);
-    busy_scan_interval = get_busy_scan_interval(main_server);
-    idle_scan_interval = get_idle_scan_interval(main_server);
-    g_wakeup_timeout = min(error_scan_interval, busy_scan_interval);
-    g_wakeup_timeout = min(idle_scan_interval, g_wakeup_timeout);
+    g_wakeup_timeout = min(sconf->error_scan_interval,
+                           sconf->busy_scan_interval);
+    g_wakeup_timeout = min(sconf->idle_scan_interval,
+                           g_wakeup_timeout);
     if (g_wakeup_timeout == 0)
         g_wakeup_timeout = 1;   /* Make it reasonable */
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c Thu Sep 17 13:56:23 2009
@@ -57,7 +57,6 @@
 
 static int g_process_counter = 0;
 static apr_pool_t *g_inode_cginame_map = NULL;
-static const char *g_socket_dir = NULL;
 
 static apr_status_t ap_unix_create_privileged_process(apr_proc_t * newproc,
                                                       const char *progname,
@@ -175,6 +174,8 @@
                    fcgid_procnode * procnode)
 {
     server_rec *main_server = procinfo->main_server;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
     apr_status_t rv = APR_SUCCESS;
     apr_file_t *file;
     int omask, retcode, unix_socket;
@@ -214,26 +215,17 @@
         }
     }
 
-    if (!g_socket_dir) {
-        g_socket_dir = get_socketpath(procinfo->main_server);
-        if (!g_socket_dir) {
-            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_os_error(),
-                         procinfo->main_server,
-                         "mod_fcgid: can't get socket path");
-            return APR_ENOMEM;
-        }
-    }
-
     /* 
        Create UNIX domain socket before spawn 
      */
 
     /* Generate a UNIX domain socket file path */
-    /* XXX It's nothing I can do if strlen(g_socket_dir) too long... */
+    /* XXX It's nothing I can do if the socket dir is too long... */
     memset(&unix_addr, 0, sizeof(unix_addr));
     unix_addr.sun_family = AF_UNIX;
     apr_snprintf(unix_addr.sun_path, sizeof(unix_addr.sun_path) - 1,
-                 "%s/%" APR_PID_T_FMT ".%d", g_socket_dir, getpid(), g_process_counter++);
+                 "%s/%" APR_PID_T_FMT ".%d", sconf->sockname_prefix,
+                 getpid(), g_process_counter++);
     strncpy(procnode->socket_path, unix_addr.sun_path,
             sizeof(procnode->socket_path) - 1);
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c Thu Sep 17 13:56:23 2009
@@ -130,15 +130,14 @@
     fcgid_procnode *ptmpnode = NULL;
     int i;
     apr_status_t rv;
-    const char *fname;
-
-    fname = get_shmpath(main_server);
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     /* Remove share memory first */
-    apr_shm_remove(fname, main_server->process->pconf);
+    apr_shm_remove(sconf->shmname_path, main_server->process->pconf);
 
     /* Create share memory */
-    if ((rv = apr_shm_create(&g_sharemem, shmem_size, fname,
+    if ((rv = apr_shm_create(&g_sharemem, shmem_size, sconf->shmname_path,
                              main_server->process->pconf)) != APR_SUCCESS)
     {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, main_server,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c Thu Sep 17 13:56:23 2009
@@ -35,20 +35,15 @@
 
 static apr_pool_t *g_stat_pool = NULL;
 static struct fcgid_stat_node *g_stat_list_header = NULL;
-static int g_time_score;
-static int g_termination_score;
-static int g_spawn_score;
-static int g_score_uplimit;
-static int g_max_process;
 static int g_total_process;
-static int g_max_class_process;
-static int g_min_class_process;
 
 static void
 register_life_death(server_rec * main_server,
                     fcgid_procnode * procnode, int life_or_death)
 {
     struct fcgid_stat_node *previous_node, *current_node;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     if (!g_stat_pool || !procnode)
         abort();
@@ -73,19 +68,17 @@
 
         /* Increase the score first */
         if (life_or_death == REGISTER_LIFE) {
-            current_node->score += g_spawn_score;
+            current_node->score += sconf->spawn_score;
             current_node->process_counter++;
         } else {
-            current_node->score += g_termination_score;
+            current_node->score += sconf->termination_score;
             current_node->process_counter--;
         }
 
         /* Decrease the score base on the time passing */
-        current_node->score -= g_time_score * (int) (apr_time_sec(now)
-                                                     -
-                                                     apr_time_sec
-                                                     (current_node->
-                                                      last_stat_time));
+        current_node->score -= 
+          sconf->time_score * 
+          (int)(apr_time_sec(now) - apr_time_sec(current_node->last_stat_time));
 
         /* Make score reasonable */
         if (current_node->score < 0)
@@ -124,15 +117,6 @@
                      "mod_fcgid: can't create stat pool");
         exit(1);
     }
-
-    /* Initialize the variables from configuration */
-    g_time_score = get_time_score(main_server);
-    g_termination_score = get_termination_score(main_server);
-    g_spawn_score = get_spawn_score(main_server);
-    g_score_uplimit = get_spawnscore_uplimit(main_server);
-    g_max_process = get_max_process(main_server);
-    g_max_class_process = get_max_class_process(main_server);
-    g_min_class_process = get_min_class_process(main_server);
 }
 
 void
@@ -160,6 +144,8 @@
 int is_spawn_allowed(server_rec * main_server, fcgid_command * command)
 {
     struct fcgid_stat_node *current_node;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     if (!command || !g_stat_pool)
         return 1;
@@ -181,29 +167,27 @@
     else {
         apr_time_t now = apr_time_now();
 
-        current_node->score -= g_time_score * (int) (apr_time_sec(now)
-                                                     -
-                                                     apr_time_sec
-                                                     (current_node->
-                                                      last_stat_time));
+        current_node->score -= 
+          sconf->time_score * 
+          (int)(apr_time_sec(now) - apr_time_sec(current_node->last_stat_time));
         current_node->last_stat_time = now;
         if (current_node->score < 0)
             current_node->score = 0;
 
         /* Score is higher than up limit? */
-        if (current_node->score >= g_score_uplimit) {
+        if (current_node->score >= sconf->spawnscore_uplimit) {
             ap_log_error(APLOG_MARK, APLOG_INFO, 0, main_server,
                          "mod_fcgid: %s spawn score %d >= %d, skip the spawn request",
                          command->cgipath, current_node->score,
-                         g_score_uplimit);
+                         sconf->spawnscore_uplimit);
             return 0;
         }
 
         /* Total process count higher than up limit? */
-        if (g_total_process >= g_max_process) {
+        if (g_total_process >= sconf->max_process_count) {
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, main_server,
                          "mod_fcgid: %s total process count %d >= %d, skip the spawn request",
-                         command->cgipath, g_total_process, g_max_process);
+                         command->cgipath, g_total_process, sconf->max_process_count);
             return 0;
         }
 
@@ -211,11 +195,11 @@
            Process count of this class higher than up limit?
          */
         /* I need max class proccess count */
-        if (current_node->process_counter >= g_max_class_process) {
+        if (current_node->process_counter >= sconf->max_class_process_count) {
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, main_server,
                          "mod_fcgid: too many %s processes (current:%d, max:%d), skip the
spawn request",
                          command->cgipath, current_node->process_counter,
-                         g_max_class_process);
+                         sconf->max_class_process_count);
             return 0;
         }
 
@@ -223,9 +207,11 @@
     }
 }
 
-int is_kill_allowed(fcgid_procnode * procnode)
+int is_kill_allowed(server_rec * main_server, fcgid_procnode * procnode)
 {
     struct fcgid_stat_node *previous_node, *current_node;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     if (!g_stat_pool || !procnode)
         return 0;
@@ -246,7 +232,7 @@
 
     if (current_node) {
         /* Found the node */
-        if (current_node->process_counter <= g_min_class_process)
+        if (current_node->process_counter <= sconf->min_class_process_count)
             return 0;
     }
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.h?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.h Thu Sep 17 13:56:23 2009
@@ -25,6 +25,6 @@
                           fcgid_procnode * procnode);
 void register_spawn(server_rec * main_server, fcgid_procnode * procnode);
 int is_spawn_allowed(server_rec * main_server, fcgid_command * command);
-int is_kill_allowed(fcgid_procnode * procnode);
+int is_kill_allowed(server_rec * main_server, fcgid_procnode * procnode);
 
 #endif

Modified: httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c?rev=816191&r1=816190&r2=816191&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c Thu Sep 17 13:56:23 2009
@@ -543,10 +543,12 @@
     const char *userdata_key = "fcgid_init";
     apr_status_t rv;
     void *dummy = NULL;
+    fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+                                                    &fcgid_module);
 
     ap_add_version_component(config_pool, MODFCGID_PRODUCT);
 
-    g_php_fix_pathinfo_enable = get_php_fix_pathinfo_enable(main_server);
+    g_php_fix_pathinfo_enable = sconf->php_fix_pathinfo_enable;
 
     /* Initialize process manager only once */
     apr_pool_userdata_get(&dummy, userdata_key,



Mime
View raw message