]> granicus.if.org Git - apache/commitdiff
Begin to sanitize the MPM configuration directives. Now, all
authorRyan Bloom <rbb@apache.org>
Mon, 13 Aug 2001 04:57:35 +0000 (04:57 +0000)
committerRyan Bloom <rbb@apache.org>
Mon, 13 Aug 2001 04:57:35 +0000 (04:57 +0000)
MPMs use the same functions for all common MPM directives.  This
should make it easier to catch all bugs in these directives once.

Everybody should check their favorite MPM to ensure that it still
compiles, and that these directives work.  This is a big patch, and
although it looks good, and things compiled for me, that is no
garauntee that it will work on all platforms.  :-)

Submitted by: Cody Sherr <csherr@covalent.net>

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

21 files changed:
CHANGES
include/mpm_common.h
os/unix/unixd.c
server/core.c
server/listen.c
server/mpm/beos/beos.c
server/mpm/beos/mpm.h
server/mpm/experimental/perchild/mpm.h
server/mpm/experimental/perchild/perchild.c
server/mpm/perchild/mpm.h
server/mpm/perchild/perchild.c
server/mpm/prefork/mpm.h
server/mpm/prefork/prefork.c
server/mpm/spmt_os2/mpm.h
server/mpm/spmt_os2/spmt_os2.c
server/mpm/threaded/mpm.h
server/mpm/threaded/threaded.c
server/mpm/winnt/mpm.h
server/mpm/worker/mpm.h
server/mpm/worker/worker.c
server/mpm_common.c

diff --git a/CHANGES b/CHANGES
index a7b0e6b8f5435150390ab0970c4dd057f74f6e65..1417ec182fec3c0197d093bd7b42812d9d3a1548 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.24-dev
 
+  *) Begin to sanitize the MPM configuration directives.  Now, all
+     MPMs use the same functions for all common MPM directives.  This
+     should make it easier to catch all bugs in these directives once.
+     [Cody Sherr <csherr@covalent.net>]
+
   *) Close a major resource leak.  Everytime we had issued a
      graceful restart, we leaked a socket descriptor.
      [Ryan Bloom]
index 4d160de180194b7af0f03c9c008ee9a468510695..7c246d4085b0bb7cb075a29dc4300873d0f32f9e 100644 (file)
@@ -208,6 +208,67 @@ AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod);
 AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num);
 #endif
 
+/*
+ * These data members are common to all mpms. Each new mpm
+ * should either use the appropriate ap_mpm_set_* function
+ * in their command table or create their own for custom or
+ * OS specific needs. These should work for most.
+ */
+
+/**
+ * The maximum number of requests each child thread or
+ * process handles before dying off
+ */
+#ifdef AP_MPM_WANT_SET_MAX_REQUESTS
+extern int               ap_max_requests_per_child;
+AP_DECLARE(const  char *) ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
+                                                 const char *arg);
+#endif
+
+/**
+ * The filename used to store the process id.
+ */
+#ifdef AP_MPM_WANT_SET_PIDFILE
+extern const char        *ap_pid_fname;
+AP_DECLARE(const char *) ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
+                                           const char *arg);
+#endif
+
+/**
+ * The name of lockfile used when Apache needs to lock the accept() call.
+ */
+#ifdef AP_MPM_WANT_SET_LOCKFILE
+extern const char        *ap_lock_fname;
+AP_DECLARE(const char *) ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy,
+                                            const char *arg);
+#endif
+
+/**
+ * The system mutex implementation to use for the accept mutex.
+ */
+#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+extern apr_lockmech_e_np accept_lock_mech;
+AP_DECLARE(const char *) ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy,
+                                                    const char *arg);
+#endif
+
+/*
+ * Set the scorboard file.
+ */
+#ifdef AP_MPM_WANT_SET_SCOREBOARD
+AP_DECLARE(const char *) ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
+                                              const char *arg);
+#endif
+
+/*
+ * The directory that the server changes directory to dump core.
+ */
+#ifdef AP_MPM_WANT_SET_COREDUMPDIR
+extern char ap_coredump_dir[MAX_STRING_LEN];
+AP_DECLARE(const char *) ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
+                                               const char *arg);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 0a9f4ab64159c188ebb965a75c4adb05dd7015d2..ab1a12dbde544cc68fb5ec0e0f0c22ed630d4405 100644 (file)
@@ -63,6 +63,7 @@
 #include "http_main.h"
 #include "http_log.h"
 #include "unixd.h"
+#include "apr_lock.h"
 #include "mpm_common.h"
 #include "os.h"
 #include "ap_mpm.h"
index e0bff5f2854189504a852d93b6812be7fd6b607f..e7cd0fd21b46b6e2d0c8049c29c5d2cd24a164c5 100644 (file)
@@ -85,7 +85,8 @@
 #include "util_filter.h"
 #include "util_ebcdic.h"
 #include "mpm.h"
-
+#include "mpm_common.h"
+#include "scoreboard.h"
 #include "mod_core.h"
 
 
@@ -2841,6 +2842,36 @@ AP_INIT_ITERATE("SetOutputFilter", add_filter, NULL, ACCESS_CONF,
    "filters to be run"),
 AP_INIT_ITERATE("SetInputFilter", add_input_filter, NULL, ACCESS_CONF,
    "filters to be run on the request body"),
+
+/*
+ * These are default configuration directives that mpms can/should
+ * pay attention to. If an mpm wishes to use these, they should
+ * #defined them in mpm.h.
+ */
+#ifdef AP_MPM_WANT_SET_PIDFILE
+AP_INIT_TAKE1("PidFile",  ap_mpm_set_pidfile, NULL, RSRC_CONF, \
+             "A file for logging the server process ID"),
+#endif
+#ifdef AP_MPM_WANT_SET_SCOREBOARD
+AP_INIT_TAKE1("ScoreBoardFile", ap_mpm_set_scoreboard, NULL, RSRC_CONF, \
+             "A file for Apache to maintain runtime process management information"),
+#endif
+#ifdef AP_MPM_WANT_SET_LOCKFILE
+AP_INIT_TAKE1("LockFile",  ap_mpm_set_lockfile, NULL, RSRC_CONF, \
+             "The lockfile used when Apache needs to lock the accept() call"),
+#endif
+#ifdef AP_MPM_WANT_SET_MAX_REQUESTS
+AP_INIT_TAKE1("MaxRequestsPerChild", ap_mpm_set_max_requests, NULL, RSRC_CONF,\
+             "Maximum number of requests a particular child serves before dying."),
+#endif
+#ifdef AP_MPM_WANT_SET_COREDUMPDIR
+AP_INIT_TAKE1("CoreDumpDirectory", ap_mpm_set_coredumpdir, NULL, RSRC_CONF, \
+             "The location of the directory Apache changes to before dumping core"),
+#endif
+#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+AP_INIT_TAKE1("AcceptMutex", ap_mpm_set_accept_lock_mech, NULL, RSRC_CONF, \
+             "The system mutex implementation to use for the accept mutex"),
+#endif
 { NULL }
 };
 
index 169c090cacb7b6f876dc6d01ceb3acbf6b8efbeb..8225efc9e979c23c87eb2d2d78f71f857262d330 100644 (file)
@@ -58,6 +58,7 @@
 
 #include "apr_network_io.h"
 #include "apr_strings.h"
+#include "apr_lock.h"
 
 #define APR_WANT_STRFUNC
 #include "apr_want.h"
@@ -71,7 +72,6 @@
 #include "mpm.h"
 #include "mpm_common.h"
 
-
 ap_listen_rec *ap_listeners;
 #if APR_HAVE_IPV6
 static int default_family = APR_UNSPEC;
index a3dfd4f7ef89c68d23dced3e929c3db2ea3cf773..c7ee021d41c023715f0a6859345d247ec6f29069 100644 (file)
@@ -92,8 +92,6 @@ extern int _kset_fd_limit_(int num);
  */
 
 int ap_threads_per_child=HARD_THREAD_LIMIT;         /* Worker threads per child */
-static int ap_max_requests_per_child=0;
-static const char *ap_pid_fname=NULL;
 static int ap_threads_to_start=0;
 static int min_spare_threads=0;
 static int max_spare_threads=0;
@@ -126,7 +124,6 @@ static void check_restart(void *data);
  */
 int ap_max_child_assigned = -1;
 int ap_max_threads_limit = -1;
-char ap_coredump_dir[MAX_STRING_LEN];
 
 static apr_socket_t *udp_sock;
 static apr_sockaddr_t *udp_sa;
@@ -984,32 +981,6 @@ static void beos_hooks(apr_pool_t *p)
     ap_hook_pre_config(beos_pre_config, NULL, NULL, APR_HOOK_MIDDLE); 
 }
 
-
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
-static const char *set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
 static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg) 
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1107,43 +1078,8 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, const cha
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
 static const command_rec beos_cmds[] = {
 LISTEN_COMMANDS
-AP_INIT_TAKE1( "PidFile", set_pidfile, NULL, RSRC_CONF,
-    "A file for logging the server process ID"),
-AP_INIT_TAKE1( "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
-    "A file for Apache to maintain runtime process management information"),
 AP_INIT_TAKE1( "StartServers", set_daemons_to_start, NULL, RSRC_CONF,
   "Number of child processes launched at server startup"),
 AP_INIT_TAKE1( "MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF,
@@ -1154,10 +1090,6 @@ AP_INIT_TAKE1( "MaxClients", set_server_limit, NULL, RSRC_CONF,
   "Maximum number of children alive at the same time" ),
 AP_INIT_TAKE1( "ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, 
   "Number of threads each child creates" ),
-AP_INIT_TAKE1( "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-  "Maximum number of requests a particular child serves before dying." ),
-AP_INIT_TAKE1( "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, 
-  "The location of the directory Apache changes to before dumping core" ),
 { NULL }
 };
 
index 3a652f050275c0e917be5629ccbea61815276c9e..98e31d5b915e473cb513ead77533ad6bb45ebd20 100644 (file)
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->servers[0][i].tid)
 #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
 
-extern int ap_max_child_assigned;
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
 
+extern int ap_max_child_assigned;
 extern server_rec *ap_server_conf;
-extern char ap_coredump_dir[MAX_STRING_LEN];
 extern int ap_threads_per_child;
 
 #endif /* APACHE_MPM_BEOS_H */
index d24f8b4abaa9f6705d4a6699c8583f7d76adedd9..cdaa46e37260031548636e51c1b61352bee8058d 100644 (file)
 
 #define MPM_NAME "Perchild"
 
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_LOCKFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE()
 #define MPM_CHILD_PID(i) (ap_child_table[i].pid)
@@ -86,6 +93,5 @@ extern int ap_threads_per_child;
 extern int ap_max_daemons_limit;
 extern ap_ctable ap_child_table[HARD_SERVER_LIMIT];
 extern server_rec *ap_server_conf;
-extern char ap_coredump_dir[MAX_STRING_LEN];
 
 #endif /* APACHE_MPM_PERCHILD_H */
index 39a89a3207e874651b5a0c647af97f2326e73219..efb68418ceb985e64c8d29b1c2b421b8cee95b42 100644 (file)
@@ -116,9 +116,8 @@ static int min_spare_threads = 0;
 static int max_spare_threads = 0;
 static int max_threads = 0;
 static int max_requests_per_child = 0;
-static const char *ap_pid_fname=NULL;
-static int num_daemons=0;
-static int curr_child_num=0;
+static int num_daemons = 0;
+static int curr_child_num = 0;
 static int workers_may_exit = 0;
 static int requests_this_child;
 static int num_listenfds = 0;
@@ -161,8 +160,6 @@ struct ap_ctable    ap_child_table[HARD_SERVER_LIMIT];
 int ap_max_daemons_limit = -1;
 int ap_threads_per_child = HARD_THREAD_LIMIT;
 
-char ap_coredump_dir[MAX_STRING_LEN];
-
 module AP_MODULE_DECLARE_DATA mpm_perchild_module;
 
 static apr_file_t *pipe_of_death_in = NULL;
@@ -214,9 +211,7 @@ static apr_lock_t *idle_thread_count_mutex;
 #else
 #define SAFE_ACCEPT(stmt) (stmt)
 static apr_lock_t *process_accept_mutex;
-static apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT;
 #endif /* NO_SERIALIZED_ACCEPT */
-static const char *lock_fname;
 static apr_lock_t *thread_accept_mutex;
 
 AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
@@ -890,8 +885,8 @@ static void child_main(int child_num_arg)
 
     /*stuff to do before we switch id's, so we have permissions.*/
 
-    rv = SAFE_ACCEPT(apr_lock_child_init(&process_accept_mutex, lock_fname,
-                                        pchild));
+    rv = SAFE_ACCEPT(apr_lock_child_init(&process_accept_mutex, ap_lock_fname,
+                                        pchild));
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                      "Couldn't initialize cross-process lock in child");
@@ -1198,12 +1193,12 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
     ap_log_pid(pconf, ap_pid_fname);
 
     /* Initialize cross-process accept lock */
-    lock_fname = apr_psprintf(_pconf, "%s.%u",
-                             ap_server_root_relative(_pconf, lock_fname),
+    ap_lock_fname = apr_psprintf(_pconf, "%s.%u",
+                             ap_server_root_relative(_pconf, ap_lock_fname),
                              my_pid);
     rv = SAFE_ACCEPT(apr_lock_create_np(&process_accept_mutex, APR_MUTEX,
                                         APR_CROSS_PROCESS, accept_lock_mech,
-                                        lock_fname, _pconf));
+                                        ap_lock_fname, _pconf));
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
                      "Couldn't create cross-process lock");
@@ -1355,7 +1350,7 @@ static void perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *pte
     max_threads = HARD_THREAD_LIMIT;
     ap_pid_fname = DEFAULT_PIDLOG;
     ap_scoreboard_fname = DEFAULT_SCOREBOARD;
-    lock_fname = DEFAULT_LOCKFILE;
+    ap_lock_fname = DEFAULT_LOCKFILE;
     max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     curr_child_num = 0;
 
@@ -1384,7 +1379,7 @@ static int pass_request(request_rec *r)
                                                  &mpm_perchild_module);
     char *foo;
     apr_size_t len;
-    int zero = 0;
+    apr_off_t zero = 0;
 
     apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool);
     len = strlen(foo);
@@ -1518,7 +1513,7 @@ static int perchild_post_read(request_rec *r)
     return OK;
 }
 
-static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes)
+static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_off_t *readbytes)
 {
     apr_bucket *e;
     apr_status_t rv;
@@ -1573,41 +1568,6 @@ static void perchild_hooks(apr_pool_t *p)
     ap_register_input_filter("PERCHILD_BUFFER", perchild_buffer, AP_FTYPE_CONTENT);
 }
 
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
-static const char *set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
-static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    lock_fname = arg;
-    return NULL;
-}
 static const char *set_num_daemons (cmd_parms *cmd, void *dummy, const char *arg) 
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1721,38 +1681,6 @@ static const char *set_max_threads(cmd_parms *cmd, void *dummy, const char *arg)
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy,
-                                   const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
 static const char *set_child_per_uid(cmd_parms *cmd, void *dummy, const char *u,
                                      const char *g, const char *num)
 {
@@ -1802,65 +1730,9 @@ static const char *assign_childuid(cmd_parms *cmd, void *dummy, const char *uid,
     return NULL;
 }
 
-static const char *set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (!strcasecmp(arg, "default")) {
-        accept_lock_mech = APR_LOCK_DEFAULT;
-    }
-#if APR_HAS_FLOCK_SERIALIZE
-    else if (!strcasecmp(arg, "flock")) {
-        accept_lock_mech = APR_LOCK_FLOCK;
-    }
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-    else if (!strcasecmp(arg, "fcntl")) {
-        accept_lock_mech = APR_LOCK_FCNTL;
-    }
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-    else if (!strcasecmp(arg, "sysvsem")) {
-        accept_lock_mech = APR_LOCK_SYSVSEM;
-    }
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    else if (!strcasecmp(arg, "proc_pthread")) {
-        accept_lock_mech = APR_LOCK_PROC_PTHREAD;
-    }
-#endif
-    else {
-        return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid "
-                           "ones for this platform are: default"
-#if APR_HAS_FLOCK_SERIALIZE
-                           ", flock"
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-                           ", fcntl"
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-                           ", sysvsem"
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-                           ", proc_pthread"
-#endif
-                           , NULL);
-    }
-    return NULL;
-}
-
 static const command_rec perchild_cmds[] = {
 UNIX_DAEMON_COMMANDS
 LISTEN_COMMANDS
-AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
-              "A file for logging the server process ID"),
-AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
-              "A file for Apache to maintain runtime process management information"),
-AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF,
-              "The lockfile used when Apache needs to lock the accept() call"),
 AP_INIT_TAKE1("NumServers", set_num_daemons, NULL, RSRC_CONF,
               "Number of children alive at the same time"),
 AP_INIT_TAKE1("StartThreads", set_threads_to_start, NULL, RSRC_CONF,
@@ -1871,16 +1743,10 @@ AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF,
               "Maximum number of idle threads per child"),
 AP_INIT_TAKE1("MaxThreadsPerChild", set_max_threads, NULL, RSRC_CONF,
               "Maximum number of threads per child"),
-AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-              "Maximum number of requests a particular child serves before dying."),
-AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
-              "The location of the directory Apache changes to before dumping core"),
 AP_INIT_TAKE3("ChildperUserID", set_child_per_uid, NULL, RSRC_CONF,
               "Specify a User and Group for a specific child process."),
 AP_INIT_TAKE2("AssignUserID", assign_childuid, NULL, RSRC_CONF,
               "Tie a virtual host to a specific child process."),
-AP_INIT_TAKE1("AcceptMutex", set_accept_lock_mech, NULL, RSRC_CONF,
-              "The system mutex implementation to use for the accept mutex"),
 { NULL }
 };
 
index d24f8b4abaa9f6705d4a6699c8583f7d76adedd9..cdaa46e37260031548636e51c1b61352bee8058d 100644 (file)
 
 #define MPM_NAME "Perchild"
 
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_LOCKFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE()
 #define MPM_CHILD_PID(i) (ap_child_table[i].pid)
@@ -86,6 +93,5 @@ extern int ap_threads_per_child;
 extern int ap_max_daemons_limit;
 extern ap_ctable ap_child_table[HARD_SERVER_LIMIT];
 extern server_rec *ap_server_conf;
-extern char ap_coredump_dir[MAX_STRING_LEN];
 
 #endif /* APACHE_MPM_PERCHILD_H */
index 39a89a3207e874651b5a0c647af97f2326e73219..efb68418ceb985e64c8d29b1c2b421b8cee95b42 100644 (file)
@@ -116,9 +116,8 @@ static int min_spare_threads = 0;
 static int max_spare_threads = 0;
 static int max_threads = 0;
 static int max_requests_per_child = 0;
-static const char *ap_pid_fname=NULL;
-static int num_daemons=0;
-static int curr_child_num=0;
+static int num_daemons = 0;
+static int curr_child_num = 0;
 static int workers_may_exit = 0;
 static int requests_this_child;
 static int num_listenfds = 0;
@@ -161,8 +160,6 @@ struct ap_ctable    ap_child_table[HARD_SERVER_LIMIT];
 int ap_max_daemons_limit = -1;
 int ap_threads_per_child = HARD_THREAD_LIMIT;
 
-char ap_coredump_dir[MAX_STRING_LEN];
-
 module AP_MODULE_DECLARE_DATA mpm_perchild_module;
 
 static apr_file_t *pipe_of_death_in = NULL;
@@ -214,9 +211,7 @@ static apr_lock_t *idle_thread_count_mutex;
 #else
 #define SAFE_ACCEPT(stmt) (stmt)
 static apr_lock_t *process_accept_mutex;
-static apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT;
 #endif /* NO_SERIALIZED_ACCEPT */
-static const char *lock_fname;
 static apr_lock_t *thread_accept_mutex;
 
 AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
@@ -890,8 +885,8 @@ static void child_main(int child_num_arg)
 
     /*stuff to do before we switch id's, so we have permissions.*/
 
-    rv = SAFE_ACCEPT(apr_lock_child_init(&process_accept_mutex, lock_fname,
-                                        pchild));
+    rv = SAFE_ACCEPT(apr_lock_child_init(&process_accept_mutex, ap_lock_fname,
+                                        pchild));
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                      "Couldn't initialize cross-process lock in child");
@@ -1198,12 +1193,12 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
     ap_log_pid(pconf, ap_pid_fname);
 
     /* Initialize cross-process accept lock */
-    lock_fname = apr_psprintf(_pconf, "%s.%u",
-                             ap_server_root_relative(_pconf, lock_fname),
+    ap_lock_fname = apr_psprintf(_pconf, "%s.%u",
+                             ap_server_root_relative(_pconf, ap_lock_fname),
                              my_pid);
     rv = SAFE_ACCEPT(apr_lock_create_np(&process_accept_mutex, APR_MUTEX,
                                         APR_CROSS_PROCESS, accept_lock_mech,
-                                        lock_fname, _pconf));
+                                        ap_lock_fname, _pconf));
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
                      "Couldn't create cross-process lock");
@@ -1355,7 +1350,7 @@ static void perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *pte
     max_threads = HARD_THREAD_LIMIT;
     ap_pid_fname = DEFAULT_PIDLOG;
     ap_scoreboard_fname = DEFAULT_SCOREBOARD;
-    lock_fname = DEFAULT_LOCKFILE;
+    ap_lock_fname = DEFAULT_LOCKFILE;
     max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     curr_child_num = 0;
 
@@ -1384,7 +1379,7 @@ static int pass_request(request_rec *r)
                                                  &mpm_perchild_module);
     char *foo;
     apr_size_t len;
-    int zero = 0;
+    apr_off_t zero = 0;
 
     apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool);
     len = strlen(foo);
@@ -1518,7 +1513,7 @@ static int perchild_post_read(request_rec *r)
     return OK;
 }
 
-static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes)
+static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_off_t *readbytes)
 {
     apr_bucket *e;
     apr_status_t rv;
@@ -1573,41 +1568,6 @@ static void perchild_hooks(apr_pool_t *p)
     ap_register_input_filter("PERCHILD_BUFFER", perchild_buffer, AP_FTYPE_CONTENT);
 }
 
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
-static const char *set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
-static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    lock_fname = arg;
-    return NULL;
-}
 static const char *set_num_daemons (cmd_parms *cmd, void *dummy, const char *arg) 
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1721,38 +1681,6 @@ static const char *set_max_threads(cmd_parms *cmd, void *dummy, const char *arg)
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy,
-                                   const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
 static const char *set_child_per_uid(cmd_parms *cmd, void *dummy, const char *u,
                                      const char *g, const char *num)
 {
@@ -1802,65 +1730,9 @@ static const char *assign_childuid(cmd_parms *cmd, void *dummy, const char *uid,
     return NULL;
 }
 
-static const char *set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (!strcasecmp(arg, "default")) {
-        accept_lock_mech = APR_LOCK_DEFAULT;
-    }
-#if APR_HAS_FLOCK_SERIALIZE
-    else if (!strcasecmp(arg, "flock")) {
-        accept_lock_mech = APR_LOCK_FLOCK;
-    }
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-    else if (!strcasecmp(arg, "fcntl")) {
-        accept_lock_mech = APR_LOCK_FCNTL;
-    }
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-    else if (!strcasecmp(arg, "sysvsem")) {
-        accept_lock_mech = APR_LOCK_SYSVSEM;
-    }
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    else if (!strcasecmp(arg, "proc_pthread")) {
-        accept_lock_mech = APR_LOCK_PROC_PTHREAD;
-    }
-#endif
-    else {
-        return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid "
-                           "ones for this platform are: default"
-#if APR_HAS_FLOCK_SERIALIZE
-                           ", flock"
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-                           ", fcntl"
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-                           ", sysvsem"
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-                           ", proc_pthread"
-#endif
-                           , NULL);
-    }
-    return NULL;
-}
-
 static const command_rec perchild_cmds[] = {
 UNIX_DAEMON_COMMANDS
 LISTEN_COMMANDS
-AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
-              "A file for logging the server process ID"),
-AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
-              "A file for Apache to maintain runtime process management information"),
-AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF,
-              "The lockfile used when Apache needs to lock the accept() call"),
 AP_INIT_TAKE1("NumServers", set_num_daemons, NULL, RSRC_CONF,
               "Number of children alive at the same time"),
 AP_INIT_TAKE1("StartThreads", set_threads_to_start, NULL, RSRC_CONF,
@@ -1871,16 +1743,10 @@ AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF,
               "Maximum number of idle threads per child"),
 AP_INIT_TAKE1("MaxThreadsPerChild", set_max_threads, NULL, RSRC_CONF,
               "Maximum number of threads per child"),
-AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-              "Maximum number of requests a particular child serves before dying."),
-AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
-              "The location of the directory Apache changes to before dumping core"),
 AP_INIT_TAKE3("ChildperUserID", set_child_per_uid, NULL, RSRC_CONF,
               "Specify a User and Group for a specific child process."),
 AP_INIT_TAKE2("AssignUserID", assign_childuid, NULL, RSRC_CONF,
               "Tie a virtual host to a specific child process."),
-AP_INIT_TAKE1("AcceptMutex", set_accept_lock_mech, NULL, RSRC_CONF,
-              "The system mutex implementation to use for the accept mutex"),
 { NULL }
 };
 
index efad24f9eba470542318b0c5a448820e242fb204..429c61f1cb61cd70dc40de5bd03c62bbc382b809 100644 (file)
 
 #define MPM_NAME "Prefork"
 
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_LOCKFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+
 #define AP_MPM_USES_POD 1
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image())
@@ -77,5 +84,4 @@
 extern int ap_threads_per_child;
 extern int ap_max_daemons_limit;
 extern server_rec *ap_server_conf;
-extern char ap_coredump_dir[MAX_STRING_LEN];
 #endif /* APACHE_MPM_PREFORK_H */
index fda1f03601cb0b7c356493917bb8b67e5e0b1107..c83077d7cfed91be12941fbe0d33a6f1968dfc92 100644 (file)
 /* config globals */
 
 int ap_threads_per_child=0;         /* Worker threads per child */
-static int ap_max_requests_per_child=0;
-static const char *ap_pid_fname=NULL;
 static apr_lock_t *accept_lock;
-static const char *ap_lock_fname;
-static apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT;
 static int ap_daemons_to_start=0;
 static int ap_daemons_min_free=0;
 static int ap_daemons_max_free=0;
@@ -154,8 +150,6 @@ static ap_pod_t *pod;
 int ap_max_daemons_limit = -1;
 server_rec *ap_server_conf;
 
-char ap_coredump_dir[MAX_STRING_LEN];
-
 /* *Non*-shared http_main globals... */
 
 static apr_socket_t *sd;
@@ -1348,42 +1342,6 @@ static void prefork_hooks(apr_pool_t *p)
     ap_hook_pre_config(prefork_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
 }
 
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
-static const char *set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
-static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_lock_fname = arg;
-    return NULL;
-}
-
 static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg) 
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1455,96 +1413,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
-static const char *set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (!strcasecmp(arg, "default")) {
-        accept_lock_mech = APR_LOCK_DEFAULT;
-    }
-#if APR_HAS_FLOCK_SERIALIZE
-    else if (!strcasecmp(arg, "flock")) {
-        accept_lock_mech = APR_LOCK_FLOCK;
-    }
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-    else if (!strcasecmp(arg, "fcntl")) {
-        accept_lock_mech = APR_LOCK_FCNTL;
-    }
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-    else if (!strcasecmp(arg, "sysvsem")) {
-        accept_lock_mech = APR_LOCK_SYSVSEM;
-    }
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    else if (!strcasecmp(arg, "proc_pthread")) {
-        accept_lock_mech = APR_LOCK_PROC_PTHREAD;
-    }
-#endif
-    else {
-        return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid "
-                           "ones for this platform are: default"
-#if APR_HAS_FLOCK_SERIALIZE
-                           ", flock"
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-                           ", fcntl"
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-                           ", sysvsem"
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-                           ", proc_pthread"
-#endif
-                           , NULL);
-    }
-    return NULL;
-}
-
 static const command_rec prefork_cmds[] = {
 UNIX_DAEMON_COMMANDS
 LISTEN_COMMANDS
-AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
-              "A file for logging the server process ID"),
-AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
-              "A file for Apache to maintain runtime process management information"),
-AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF,
-              "The lockfile used when Apache needs to lock the accept() call"),
 AP_INIT_TAKE1("StartServers", set_daemons_to_start, NULL, RSRC_CONF,
               "Number of child processes launched at server startup"),
 AP_INIT_TAKE1("MinSpareServers", set_min_free_servers, NULL, RSRC_CONF,
@@ -1553,12 +1424,6 @@ AP_INIT_TAKE1("MaxSpareServers", set_max_free_servers, NULL, RSRC_CONF,
               "Maximum number of idle children"),
 AP_INIT_TAKE1("MaxClients", set_server_limit, NULL, RSRC_CONF,
               "Maximum number of children alive at the same time"),
-AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-              "Maximum number of requests a particular child serves before dying."),
-AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
-              "The location of the directory Apache changes to before dumping core"),
-AP_INIT_TAKE1("AcceptMutex", set_accept_lock_mech, NULL, RSRC_CONF,
-              "The system mutex implementation to use for the accept mutex"),
 { NULL }
 };
 
index 96062ed7d6ee984cb4747bfd7bdc3f42a6cbb358..26c65cbced54ada8cd16852a28efdcab8fda3479 100644 (file)
 
 #define MPM_NAME "SPMT_OS2"
 
-extern char ap_coredump_dir[MAX_STRING_LEN];
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+
 extern server_rec *ap_server_conf;
 extern int ap_threads_per_child;
 
index f8b9c859db8ac7a066afa666ebdf6d3baa1e347c..e9f60b513bd0bd6a0b67a4bededf8a39a9e31f0a 100644 (file)
@@ -84,8 +84,6 @@
 
 /* config globals */
 
-static int ap_max_requests_per_child=0;
-static const char *ap_pid_fname=NULL;
 static int ap_daemons_to_start=0;
 static int ap_daemons_min_free=0;
 static int ap_daemons_max_free=0;
@@ -149,8 +147,6 @@ static void clean_child_exit(int code)
     _endthread();
 }
 
-
-
 static apr_lock_t *accept_mutex = NULL;
 
 static apr_status_t accept_mutex_child_cleanup(void *foo)
@@ -1177,20 +1173,6 @@ static void spmt_os2_hooks(apr_pool_t *p)
     ap_hook_pre_config(spmt_os2_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
 }
 
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
 static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1262,37 +1244,6 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
 /* Stub functions until this MPM supports the connection status API */
 
 AP_DECLARE(void) ap_update_connection_status(long conn_id, const char *key, \
@@ -1308,8 +1259,6 @@ AP_DECLARE(void) ap_reset_connection_status(long conn_id)
 
 static const command_rec spmt_os2_cmds[] = {
 LISTEN_COMMANDS
-AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
-    "A file for logging the server process ID"),
 AP_INIT_TAKE1( "StartServers", set_daemons_to_start, NULL, RSRC_CONF, 
   "Number of child processes launched at server startup" ),
 AP_INIT_TAKE1( "MinSpareServers", set_min_free_servers, NULL, RSRC_CONF,
@@ -1318,10 +1267,6 @@ AP_INIT_TAKE1( "MaxSpareServers", set_max_free_servers, NULL, RSRC_CONF,
   "Maximum number of idle children" ),
 AP_INIT_TAKE1( "MaxClients", set_server_limit, NULL, RSRC_CONF,
   "Maximum number of children alive at the same time" ),
-AP_INIT_TAKE1( "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-  "Maximum number of requests a particular child serves before dying." ),
-AP_INIT_TAKE1( "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
-  "The location of the directory Apache changes to before dumping core" ),
 { NULL }
 };
 
index 51a3965ce3cdc1642a491f013d458f15bd4374cb..3c58c70836505d494fd56ea20ab83d36179cbb50 100644 (file)
 
 #define MPM_NAME "Threaded"
 
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_LOCKFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image())
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
@@ -73,6 +80,5 @@
 extern int ap_threads_per_child;
 extern int ap_max_daemons_limit;
 extern server_rec *ap_server_conf;
-extern char ap_coredump_dir[MAX_STRING_LEN];
 
 #endif /* APACHE_MPM_THREADED_H */
index 50bfc5d596352327e707238c9f9352a4957b6840..a35dfb636b72e909af21ba2d82f727f76e2dd902 100644 (file)
  */
 
 int ap_threads_per_child=0;         /* Worker threads per child */
-static int ap_max_requests_per_child=0;
-static const char *ap_pid_fname=NULL;
 static int ap_daemons_to_start=0;
 static int min_spare_threads=0;
 static int max_spare_threads=0;
@@ -141,8 +139,6 @@ typedef struct {
  */
 int ap_max_daemons_limit = -1;
 
-char ap_coredump_dir[MAX_STRING_LEN];
-
 static apr_file_t *pipe_of_death_in = NULL;
 static apr_file_t *pipe_of_death_out = NULL;
 static apr_lock_t *pipe_of_death_mutex;   /* insures that a child process only
@@ -181,8 +177,6 @@ static apr_lock_t *worker_thread_count_mutex;
 
 /* Locks for accept serialization */
 static apr_lock_t *accept_mutex;
-static apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT;
-static const char *lock_fname;
 
 #ifdef NO_SERIALIZED_ACCEPT
 #define SAFE_ACCEPT(stmt) APR_SUCCESS
@@ -1387,44 +1381,6 @@ static void threaded_hooks(apr_pool_t *p)
     ap_hook_pre_config(threaded_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
 }
 
-
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
-static const char *set_scoreboard(cmd_parms *cmd, void *dummy,
-                                 const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
-static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    lock_fname = arg;
-    return NULL;
-}
-
 static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy,
                                        const char *arg) 
 {
@@ -1529,98 +1485,9 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy,
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy,
-                                   const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy,
-                                   const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
-static const char *set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (!strcasecmp(arg, "default")) {
-        accept_lock_mech = APR_LOCK_DEFAULT;
-    }
-#if APR_HAS_FLOCK_SERIALIZE
-    else if (!strcasecmp(arg, "flock")) {
-        accept_lock_mech = APR_LOCK_FLOCK;
-    }
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-    else if (!strcasecmp(arg, "fcntl")) {
-        accept_lock_mech = APR_LOCK_FCNTL;
-    }
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-    else if (!strcasecmp(arg, "sysvsem")) {
-        accept_lock_mech = APR_LOCK_SYSVSEM;
-    }
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    else if (!strcasecmp(arg, "proc_pthread")) {
-        accept_lock_mech = APR_LOCK_PROC_PTHREAD;
-    }
-#endif
-    else {
-        return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid "
-                           "ones for this platform are: default"
-#if APR_HAS_FLOCK_SERIALIZE
-                           ", flock"
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-                           ", fcntl"
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-                           ", sysvsem"
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-                           ", proc_pthread"
-#endif
-                           , NULL);
-    }
-    return NULL;
-}
-
 static const command_rec threaded_cmds[] = {
 UNIX_DAEMON_COMMANDS
 LISTEN_COMMANDS
-AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
-    "A file for logging the server process ID"),
-AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
-    "A file for Apache to maintain runtime process management information"),
-AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF,
-    "The lockfile used when Apache needs to lock the accept() call"),
 AP_INIT_TAKE1("StartServers", set_daemons_to_start, NULL, RSRC_CONF,
   "Number of child processes launched at server startup"),
 AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF,
@@ -1631,12 +1498,6 @@ AP_INIT_TAKE1("MaxClients", set_server_limit, NULL, RSRC_CONF,
   "Maximum number of children alive at the same time"),
 AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF,
   "Number of threads each child creates"),
-AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-  "Maximum number of requests a particular child serves before dying."),
-AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
-  "The location of the directory Apache changes to before dumping core"),
-AP_INIT_TAKE1("AcceptMutex", set_accept_lock_mech, NULL, RSRC_CONF,
-              "The system mutex implementation to use for the accept mutex"),
 { NULL }
 };
 
index 9d8bb4ef336a23159aa54485ac319400513a3e1c..82e944f4f6d31c8856886587ecc34f1ac651acf7 100644 (file)
 
 #define MPM_NAME "WinNT"
 
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_LOCKFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+
 extern int ap_threads_per_child;
 
 #endif /* APACHE_MPM_H */
index 23ed27c1ea096f2a0d55dd70513fdc4be5dbeb16..8611da09126286cba85b526ccfc6090f1d6ee456 100644 (file)
 
 #define MPM_NAME "Worker"
 
+#define AP_MPM_WANT_SET_PIDFILE
+#define AP_MPM_WANT_SET_SCOREBOARD
+#define AP_MPM_WANT_SET_LOCKFILE
+#define AP_MPM_WANT_SET_MAX_REQUESTS
+#define AP_MPM_WANT_SET_COREDUMPDIR
+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image())
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
index 6f6211068ef07520610c8d4b06f8773cf1530475..b1a4bdbc6c9d4adf92a24aed99ace622ff1d7b4b 100644 (file)
@@ -1425,44 +1425,6 @@ static void worker_hooks(apr_pool_t *p)
     ap_hook_pre_config(worker_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
 }
 
-
-static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (cmd->server->is_virtual) {
-       return "PidFile directive not allowed in <VirtualHost>";
-    }
-    ap_pid_fname = arg;
-    return NULL;
-}
-
-static const char *set_scoreboard(cmd_parms *cmd, void *dummy,
-                                 const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
-static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    lock_fname = arg;
-    return NULL;
-}
-
 static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy,
                                        const char *arg) 
 {
@@ -1567,98 +1529,9 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy,
     return NULL;
 }
 
-static const char *set_max_requests(cmd_parms *cmd, void *dummy,
-                                   const char *arg) 
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_max_requests_per_child = atoi(arg);
-
-    return NULL;
-}
-
-static const char *set_coredumpdir (cmd_parms *cmd, void *dummy,
-                                   const char *arg) 
-{
-    apr_finfo_t finfo;
-    const char *fname;
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    fname = ap_server_root_relative(cmd->pool, arg);
-    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) 
-        || (finfo.filetype != APR_DIR)) {
-       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, 
-                         " does not exist or is not a directory", NULL);
-    }
-    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
-    return NULL;
-}
-
-static const char *set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    if (!strcasecmp(arg, "default")) {
-        accept_lock_mech = APR_LOCK_DEFAULT;
-    }
-#if APR_HAS_FLOCK_SERIALIZE
-    else if (!strcasecmp(arg, "flock")) {
-        accept_lock_mech = APR_LOCK_FLOCK;
-    }
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-    else if (!strcasecmp(arg, "fcntl")) {
-        accept_lock_mech = APR_LOCK_FCNTL;
-    }
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-    else if (!strcasecmp(arg, "sysvsem")) {
-        accept_lock_mech = APR_LOCK_SYSVSEM;
-    }
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    else if (!strcasecmp(arg, "proc_pthread")) {
-        accept_lock_mech = APR_LOCK_PROC_PTHREAD;
-    }
-#endif
-    else {
-        return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid "
-                           "ones for this platform are: default"
-#if APR_HAS_FLOCK_SERIALIZE
-                           ", flock"
-#endif
-#if APR_HAS_FCNTL_SERIALIZE
-                           ", fcntl"
-#endif
-#if APR_HAS_SYSVSEM_SERIALIZE
-                           ", sysvsem"
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-                           ", proc_pthread"
-#endif
-                           , NULL);
-    }
-    return NULL;
-}
-
 static const command_rec worker_cmds[] = {
 UNIX_DAEMON_COMMANDS
 LISTEN_COMMANDS
-AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
-    "A file for logging the server process ID"),
-AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
-    "A file for Apache to maintain runtime process management information"),
-AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF,
-    "The lockfile used when Apache needs to lock the accept() call"),
 AP_INIT_TAKE1("StartServers", set_daemons_to_start, NULL, RSRC_CONF,
   "Number of child processes launched at server startup"),
 AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF,
@@ -1669,12 +1542,6 @@ AP_INIT_TAKE1("MaxClients", set_server_limit, NULL, RSRC_CONF,
   "Maximum number of children alive at the same time"),
 AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF,
   "Number of threads each child creates"),
-AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
-  "Maximum number of requests a particular child serves before dying."),
-AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
-  "The location of the directory Apache changes to before dumping core"),
-AP_INIT_TAKE1("AcceptMutex", set_accept_lock_mech, NULL, RSRC_CONF,
-              "The system mutex implementation to use for the accept mutex"),
 { NULL }
 };
 
index e077ed0164593f6bca188ceaecf49f7e87f38778..d8222060c726b3c8aacbdc6fd638f4281200b9df 100644 (file)
@@ -70,6 +70,8 @@
 #include "apr.h"
 #include "apr_thread_proc.h"
 #include "apr_signal.h"
+#include "apr_strings.h"
+#include "apr_lock.h"
 
 #include "httpd.h"
 #include "http_config.h"
 #include "ap_mpm.h"
 #include "ap_listen.h"
 
+#ifdef AP_MPM_WANT_SET_SCOREBOARD
+#include "scoreboard.h"
+#endif
+
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
@@ -455,7 +461,7 @@ AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod)
     return APR_SUCCESS;
 }
 
-AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num)
+void ap_mpm_pod_killpg(ap_pod_t *pod, int num)
 {
     int i;
     apr_status_t rv = APR_SUCCESS;
@@ -464,4 +470,147 @@ AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num)
         rv = ap_mpm_pod_signal(pod);
     }
 }
+#endif /* #ifdef AP_MPM_USES_POD */
+
+/* standard mpm configuration handling */
+#ifdef AP_MPM_WANT_SET_PIDFILE
+const char *ap_pid_fname = NULL;
+
+AP_DECLARE(const char *)ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
+                                           const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    if (cmd->server->is_virtual) {
+       return "PidFile directive not allowed in <VirtualHost>";
+    }
+    ap_pid_fname = arg;
+    return NULL;
+}
+#endif
+
+#ifdef AP_MPM_WANT_SET_SCOREBOARD
+AP_DECLARE(const char *) ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
+                                              const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    ap_scoreboard_fname = arg;
+    return NULL;
+}
+#endif
+
+#ifdef AP_MPM_WANT_SET_LOCKFILE
+const char *ap_lock_fname = NULL;
+AP_DECLARE(const char *) ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy,
+                                            const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    ap_lock_fname = arg;
+    return NULL;
+}
+#endif
+
+#ifdef AP_MPM_WANT_SET_MAX_REQUESTS
+int ap_max_requests_per_child = 0;
+AP_DECLARE(const char *) ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
+                                                const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    ap_max_requests_per_child = atoi(arg);
+
+    return NULL;
+}
+#endif
+
+#ifdef AP_MPM_WANT_SET_COREDUMPDIR
+char ap_coredump_dir[MAX_STRING_LEN];
+AP_DECLARE(const char *) ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
+                                               const char *arg)
+{
+    apr_finfo_t finfo;
+    const char *fname;
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    fname = ap_server_root_relative(cmd->pool, arg);
+    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
+        || (finfo.filetype != APR_DIR)) {
+       return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
+                          " does not exist or is not a directory", NULL);
+    }
+    apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
+    return NULL;
+}
+#endif
+
+#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
+apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT;
+AP_DECLARE(const char *) ap_mpm_set_accept_lock_mech(cmd_parms *cmd,
+                                                    void *dummy,
+                                                    const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    if (!strcasecmp(arg, "default")) {
+        accept_lock_mech = APR_LOCK_DEFAULT;
+    }
+#if APR_HAS_FLOCK_SERIALIZE
+    else if (!strcasecmp(arg, "flock")) {
+        accept_lock_mech = APR_LOCK_FLOCK;
+    }
+#endif
+#if APR_HAS_FCNTL_SERIALIZE
+    else if (!strcasecmp(arg, "fcntl")) {
+        accept_lock_mech = APR_LOCK_FCNTL;
+    }
+#endif
+#if APR_HAS_SYSVSEM_SERIALIZE
+    else if (!strcasecmp(arg, "sysvsem")) {
+        accept_lock_mech = APR_LOCK_SYSVSEM;
+    }
+#endif
+#if APR_HAS_PROC_PTHREAD_SERIALIZE
+    else if (!strcasecmp(arg, "proc_pthread")) {
+        accept_lock_mech = APR_LOCK_PROC_PTHREAD;
+    }
+#endif
+    else {
+        return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid "
+                           "ones for this platform are: default"
+#if APR_HAS_FLOCK_SERIALIZE
+                           ", flock"
+#endif
+#if APR_HAS_FCNTL_SERIALIZE
+                           ", fcntl"
+#endif
+#if APR_HAS_SYSVSEM_SERIALIZE
+                           ", sysvsem"
+#endif
+#if APR_HAS_PROC_PTHREAD_SERIALIZE
+                           ", proc_pthread"
+#endif
+                           , NULL);
+    }
+    return NULL;
+}
 #endif