From: Jeff Trawick Date: Mon, 13 Aug 2001 16:42:13 +0000 (+0000) Subject: (hopefully) get WinNT MPM to build using mpm_common.c code; a few notes: X-Git-Tag: 2.0.24~110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f29b938e84e3cbddf155ed01da6b5fbea412cbde;p=apache (hopefully) get WinNT MPM to build using mpm_common.c code; a few notes: . the selection of ap_sock_disable() is certainly ugly, but that may need to be cleaned up in a different manner... . the directive functions couldn't be AP_DECLARE() if they are to be compatible with AP_INIT_TAKExxx(); this is an old restriction git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90138 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/mpm_common.h b/include/mpm_common.h index 35ac57c9ae..bbc28cd2a0 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -225,27 +225,27 @@ AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num); * 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); +extern int ap_max_requests_per_child; +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); +extern const char *ap_pid_fname; +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); +extern const char *ap_lock_fname; +const char *ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy, + const char *arg); #endif /** @@ -253,16 +253,16 @@ AP_DECLARE(const char *) ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy, */ #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); +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); +const char *ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy, + const char *arg); #endif /* @@ -270,8 +270,8 @@ AP_DECLARE(const char *) ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy, */ #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); +const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy, + const char *arg); #endif #ifdef __cplusplus diff --git a/libhttpd.dsp b/libhttpd.dsp index 4fb98ac24f..31b09a1330 100644 --- a/libhttpd.dsp +++ b/libhttpd.dsp @@ -409,6 +409,10 @@ SOURCE=.\include\ap_mpm.h # End Source File # Begin Source File +SOURCE=.\server\mpm_common.c +# End Source File +# Begin Source File + SOURCE=.\server\listen.c # End Source File # Begin Source File diff --git a/server/mpm/winnt/mpm.h b/server/mpm/winnt/mpm.h index 82e944f4f6..54f6025397 100644 --- a/server/mpm/winnt/mpm.h +++ b/server/mpm/winnt/mpm.h @@ -69,11 +69,8 @@ #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; diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index b4617d2ca5..81352c88d5 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -121,8 +121,6 @@ static int shutdown_in_progress = 0; static unsigned int g_blocked_threads = 0; static int ap_max_requests_per_child=0; -static char *ap_pid_fname = NULL; - static HANDLE shutdown_event; /* used to signal the parent to shutdown */ static HANDLE restart_event; /* used to signal the parent to restart */ static HANDLE exit_event; /* used by parent to signal the child to exit */ @@ -2040,19 +2038,6 @@ static void winnt_hooks(apr_pool_t *p) /* * Command processors */ -static const char *set_pidfile(cmd_parms *cmd, void *dummy, 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 "; - } - ap_pid_fname = arg; - return NULL; -} static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg) { @@ -2081,38 +2066,6 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg return NULL; } - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, 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, 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, \ @@ -2134,14 +2087,8 @@ AP_DECLARE(apr_array_header_t *) ap_get_status_table(apr_pool_t *p) static const command_rec winnt_cmds[] = { LISTEN_COMMANDS -{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1, - "A file for logging the server process ID"}, { "ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, TAKE1, "Number of threads each child creates" }, -{ "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, - "Maximum number of requests a particular child serves before dying." }, -{ "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, - "The location of the directory Apache changes to before dumping core" }, { NULL } }; diff --git a/server/mpm_common.c b/server/mpm_common.c index a8240026fd..883db93294 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -271,7 +271,7 @@ void ap_process_child_status(apr_proc_t *pid, apr_wait_t status) } #endif /* AP_MPM_WANT_PROCESS_CHILD_STATUS */ -#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) +#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) && !defined(WIN32) void ap_sock_disable_nagle(apr_socket_t *s) { /* The Nagle algorithm says that we should delay sending partial @@ -485,8 +485,8 @@ void ap_mpm_pod_killpg(ap_pod_t *pod, int num) #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 *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) { @@ -532,8 +532,8 @@ AP_DECLARE(const char *) ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy, #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 *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) { @@ -548,8 +548,8 @@ AP_DECLARE(const char *) ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy, #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) +const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy, + const char *arg) { apr_finfo_t finfo; const char *fname;