summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/mpm_common.h5
-rw-r--r--server/core.c2
-rw-r--r--server/mpm/event/event.c5
-rw-r--r--server/mpm/event/mpm_default.h7
-rw-r--r--server/mpm/mpmt_os2/mpm_default.h7
-rw-r--r--server/mpm/mpmt_os2/mpmt_os2.c5
-rw-r--r--server/mpm/netware/mpm_default.h7
-rw-r--r--server/mpm/netware/mpm_netware.c13
-rw-r--r--server/mpm/prefork/mpm_default.h7
-rw-r--r--server/mpm/prefork/prefork.c5
-rw-r--r--server/mpm/simple/simple_core.c7
-rw-r--r--server/mpm/winnt/mpm_default.h7
-rw-r--r--server/mpm/winnt/mpm_winnt.c5
-rw-r--r--server/mpm/worker/mpm_default.h7
-rw-r--r--server/mpm/worker/worker.c5
-rw-r--r--server/mpm_common.c36
16 files changed, 40 insertions, 90 deletions
diff --git a/include/mpm_common.h b/include/mpm_common.h
index bb512836c7..f08510aa46 100644
--- a/include/mpm_common.h
+++ b/include/mpm_common.h
@@ -350,6 +350,11 @@ AP_DECLARE_HOOK(const char *,mpm_get_name,(void))
*/
#define AP_ACCEPT_MUTEX_TYPE "mpm-accept"
+/* internal pre-config logic for MPM-related settings, callable only from
+ * core's pre-config hook
+ */
+void mpm_common_pre_config(apr_pool_t *pconf);
+
#ifdef __cplusplus
}
#endif
diff --git a/server/core.c b/server/core.c
index 6600df332e..846ee7532b 100644
--- a/server/core.c
+++ b/server/core.c
@@ -4150,6 +4150,8 @@ static int core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
apr_pool_cleanup_register(pconf, NULL, reset_config_defines,
apr_pool_cleanup_null);
+ mpm_common_pre_config(pconf);
+
return APR_SUCCESS;
}
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c
index 81c2ba8695..9d9231ce1c 100644
--- a/server/mpm/event/event.c
+++ b/server/mpm/event/event.c
@@ -2463,12 +2463,7 @@ static int event_pre_config(apr_pool_t * pconf, apr_pool_t * plog,
ap_daemons_limit = server_limit;
threads_per_child = DEFAULT_THREADS_PER_CHILD;
max_clients = ap_daemons_limit * threads_per_child;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
diff --git a/server/mpm/event/mpm_default.h b/server/mpm/event/mpm_default.h
index 33283772b6..079e71fe3c 100644
--- a/server/mpm/event/mpm_default.h
+++ b/server/mpm/event/mpm_default.h
@@ -51,12 +51,5 @@
#define DEFAULT_THREADS_PER_CHILD 25
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
diff --git a/server/mpm/mpmt_os2/mpm_default.h b/server/mpm/mpmt_os2/mpm_default.h
index b25effa857..5db0ecd6e7 100644
--- a/server/mpm/mpmt_os2/mpm_default.h
+++ b/server/mpm/mpmt_os2/mpm_default.h
@@ -52,12 +52,5 @@
#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c
index c961450969..b310ff98f7 100644
--- a/server/mpm/mpmt_os2/mpmt_os2.c
+++ b/server/mpm/mpmt_os2/mpmt_os2.c
@@ -476,14 +476,9 @@ static int mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *
ap_listen_pre_config();
ap_daemons_to_start = DEFAULT_START_DAEMON;
ap_thread_limit = HARD_THREAD_LIMIT;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD;
ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD;
-#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-#endif
ap_sys_privileges_handlers(1);
return OK;
diff --git a/server/mpm/netware/mpm_default.h b/server/mpm/netware/mpm_default.h
index b79cb6bdf5..b8c3ad6f4b 100644
--- a/server/mpm/netware/mpm_default.h
+++ b/server/mpm/netware/mpm_default.h
@@ -67,13 +67,6 @@
#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
/* Default stack size allocated for each worker thread.
*/
#ifndef DEFAULT_THREAD_STACKSIZE
diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c
index c39552d794..547fb1adf0 100644
--- a/server/mpm/netware/mpm_netware.c
+++ b/server/mpm/netware/mpm_netware.c
@@ -987,12 +987,10 @@ static int netware_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
ap_threads_min_free = DEFAULT_MIN_FREE_THREADS;
ap_threads_max_free = DEFAULT_MAX_FREE_THREADS;
ap_threads_limit = HARD_THREAD_LIMIT;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
+
+ /* override core's default thread stacksize */
ap_thread_stacksize = DEFAULT_THREAD_STACKSIZE;
-#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-#endif
return OK;
}
@@ -1082,7 +1080,12 @@ static int netware_check_config(apr_pool_t *p, apr_pool_t *plog,
static void netware_mpm_hooks(apr_pool_t *p)
{
- ap_hook_pre_config(netware_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
+ /* Run the pre-config hook after core's so that it can override the
+ * default setting of ThreadStackSize for NetWare.
+ */
+ static const char * const predecessors[] = {"core.c", NULL};
+
+ ap_hook_pre_config(netware_pre_config, predecessors, NULL, APR_HOOK_MIDDLE);
ap_hook_check_config(netware_check_config, NULL, NULL, APR_HOOK_MIDDLE);
//ap_hook_post_config(netware_post_config, NULL, NULL, 0);
//ap_hook_child_init(netware_child_init, NULL, NULL, APR_HOOK_MIDDLE);
diff --git a/server/mpm/prefork/mpm_default.h b/server/mpm/prefork/mpm_default.h
index 38b65432a9..5f131c5a02 100644
--- a/server/mpm/prefork/mpm_default.h
+++ b/server/mpm/prefork/mpm_default.h
@@ -46,12 +46,5 @@
#define DEFAULT_MIN_FREE_DAEMON 5
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c
index 2d6d97c976..87545bfc8f 100644
--- a/server/mpm/prefork/prefork.c
+++ b/server/mpm/prefork/prefork.c
@@ -1272,12 +1272,7 @@ static int prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
ap_daemons_max_free = DEFAULT_MAX_FREE_DAEMON;
server_limit = DEFAULT_SERVER_LIMIT;
ap_daemons_limit = server_limit;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
diff --git a/server/mpm/simple/simple_core.c b/server/mpm/simple/simple_core.c
index 9e0e870f9f..1315aa5872 100644
--- a/server/mpm/simple/simple_core.c
+++ b/server/mpm/simple/simple_core.c
@@ -26,11 +26,6 @@
static simple_core_t *g_simple_core;
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
-
APLOG_USE_MODULE(mpm_simple);
simple_core_t *simple_core_get()
@@ -58,7 +53,7 @@ apr_status_t simple_core_init_once(void)
sc->mpm_state = AP_MPMQ_STARTING;
sc->procmgr.proc_count = SIMPLE_DEF_PROC;
sc->procmgr.thread_count = SIMPLE_DEF_THREADS;
- sc->procmgr.max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
+ sc->procmgr.max_requests_per_child = 0; /* unlimited */
sc->children = apr_hash_make(sc->pool);
/* TODO: configurable spawning mech */
diff --git a/server/mpm/winnt/mpm_default.h b/server/mpm/winnt/mpm_default.h
index 184dc62f4f..a0e38efee0 100644
--- a/server/mpm/winnt/mpm_default.h
+++ b/server/mpm/winnt/mpm_default.h
@@ -55,12 +55,5 @@
*/
#define HARD_SERVER_LIMIT 1
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c
index a0009e8c8e..eee66cd191 100644
--- a/server/mpm/winnt/mpm_winnt.c
+++ b/server/mpm/winnt/mpm_winnt.c
@@ -1369,11 +1369,6 @@ static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *pt
ap_listen_pre_config();
thread_limit = DEFAULT_THREAD_LIMIT;
ap_threads_per_child = DEFAULT_THREADS_PER_CHILD;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
diff --git a/server/mpm/worker/mpm_default.h b/server/mpm/worker/mpm_default.h
index 9b8a6f91b7..244a0bb1fd 100644
--- a/server/mpm/worker/mpm_default.h
+++ b/server/mpm/worker/mpm_default.h
@@ -50,12 +50,5 @@
#define DEFAULT_THREADS_PER_CHILD 25
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c
index 7d373cab5b..de98b52ad1 100644
--- a/server/mpm/worker/worker.c
+++ b/server/mpm/worker/worker.c
@@ -1970,12 +1970,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
ap_daemons_limit = server_limit;
threads_per_child = DEFAULT_THREADS_PER_CHILD;
max_clients = ap_daemons_limit * threads_per_child;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
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)
{