summaryrefslogtreecommitdiffstats
path: root/server/mpm_common.c
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2011-03-28 18:25:20 +0200
committerJeff Trawick <trawick@apache.org>2011-03-28 18:25:20 +0200
commit5e3ba7d3ee5fc110298721d4dc5f87ca09bef940 (patch)
treed29983f4ddc654fdaae8b9701c3ca53611eca9a2 /server/mpm_common.c
parentResolve disagreement with its prototype (diff)
downloadapache2-5e3ba7d3ee5fc110298721d4dc5f87ca09bef940.tar.xz
apache2-5e3ba7d3ee5fc110298721d4dc5f87ca09bef940.zip
mpm_common.c implements a handful of config directives; the
related state has to be re-initialized to the default values at pre-config time, but that was handled inconsistently by the MPMs, resulting in unexpected behavior when some of the directives were removed across restart move that necessary initialization from the MPMs to common code run from core's pre-config; MPMs that need to override defaults can do so by running after core's pre-config (the NetWare MPM now does that) the DEFAULT_MAX_REQUESTS_PER_CHILD compile setting wasn't useful enough to keep the simple MPM wasn't consistent in which of these directives were respected and which weren't, and that hasn't changed (see procmgr.max_requests_per_child vs. ap_max_requests_per_child) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086293 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/mpm_common.c')
-rw-r--r--server/mpm_common.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/server/mpm_common.c b/server/mpm_common.c
index 153975cf50..232cbf511c 100644
--- a/server/mpm_common.c
+++ b/server/mpm_common.c
@@ -103,6 +103,30 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(const char *, mpm_get_name,
(void),
(), NULL)
+/* variables representing config directives implemented here */
+const char *ap_pid_fname;
+int ap_max_requests_per_child;
+char ap_coredump_dir[MAX_STRING_LEN];
+int ap_coredumpdir_configured;
+int ap_graceful_shutdown_timeout;
+apr_uint32_t ap_max_mem_free;
+apr_size_t ap_thread_stacksize;
+
+/* Set defaults for config directives implemented here. This is
+ * called from core's pre-config hook, so MPMs which need to override
+ * one of these should run their pre-config hook after that of core.
+ */
+void mpm_common_pre_config(apr_pool_t *pconf)
+{
+ ap_pid_fname = DEFAULT_PIDLOG;
+ ap_max_requests_per_child = 0; /* unlimited */
+ apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
+ ap_coredumpdir_configured = 0;
+ ap_graceful_shutdown_timeout = 0; /* unlimited */
+ ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+ ap_thread_stacksize = 0; /* use system default */
+}
+
/* number of calls to wait_or_timeout between writable probes */
#ifndef INTERVAL_OF_WRITABLE_PROBES
#define INTERVAL_OF_WRITABLE_PROBES 10
@@ -225,7 +249,6 @@ int initgroups(const char *name, gid_t basegid)
#endif /* def HAVE_INITGROUPS */
/* standard mpm configuration handling */
-const char *ap_pid_fname = NULL;
const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
const char *arg)
@@ -243,8 +266,6 @@ const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
return NULL;
}
-int ap_max_requests_per_child = 0;
-
const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
const char *arg)
{
@@ -264,9 +285,6 @@ const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
return NULL;
}
-char ap_coredump_dir[MAX_STRING_LEN];
-int ap_coredumpdir_configured;
-
const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
const char *arg)
{
@@ -295,8 +313,6 @@ const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
return NULL;
}
-int ap_graceful_shutdown_timeout = 0;
-
const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
const char *arg)
{
@@ -308,8 +324,6 @@ const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
return NULL;
}
-apr_uint32_t ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
const char *arg)
{
@@ -329,8 +343,6 @@ const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
return NULL;
}
-apr_size_t ap_thread_stacksize = 0; /* use system default */
-
const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy,
const char *arg)
{