Commit 7dcec843 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

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.

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
parent b5ab4dc7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
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]
+61 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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"
+32 −1
Original line number Diff line number Diff line
@@ -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 }
};

+1 −1
Original line number Diff line number Diff line
@@ -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;
Loading