36#include "mpm_default.h"
44#define _environ environ
47#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
48#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000
57#ifdef AP_ENABLE_V4_MAPPED
58#error The WinNT MPM does not currently support AP_ENABLE_V4_MAPPED
90static int first_thread_limit = 0;
133 "Number of threads each child creates" ),
135 "Maximum worker threads in a server for this run of Apache"),
189#define MAX_SIGNAL_NAME 30
288 "Child: Unable to retrieve the ready event from the parent");
299 "Child: Unable to retrieve the exit event from the parent");
307 "Child: Unable to retrieve the start_mutex from the parent");
314 "Child: Unable to access the start_mutex from the parent");
322 "Child: Unable to retrieve the scoreboard from the parent");
329 "Child: Unable to access the scoreboard from the parent");
336 "Child: Unable to reopen the scoreboard from the parent");
345 "Child: Retrieved our scoreboard from the parent.");
368 "Parent: Unable to send its generation to the child");
374 "Parent: Unable to duplicate the ready event handle for the child");
380 "Parent: Unable to send the exit event handle to the child");
386 "Parent: Unable to duplicate the exit event handle for the child");
392 "Parent: Unable to send the exit event handle to the child");
397 "Parent: Unable to retrieve the start mutex for the child");
403 "Parent: Unable to duplicate the start mutex to the child");
409 "Parent: Unable to send the start mutex to the child");
414 "Parent: Unable to retrieve the scoreboard handle for the child");
420 "Parent: Unable to duplicate the scoreboard handle to the child");
426 "Parent: Unable to send the scoreboard handle to the child");
431 "Parent: Sent the scoreboard to the child");
467 "Child: Waiting for data for listening socket %pI",
472 "Child: Unable to read socket data from parent");
480 "Child: WSASocket failed to open the inherited socket");
486 "Child: SetHandleInformation failed");
492 "Child: retrieved %d listeners from parent",
lcnt);
514 "Parent: Duplicating socket %d (%pI) and sending it to child process %lu",
519 "Parent: WSADuplicateSocket failed for socket %d. Check the FAQ.",
nsd);
527 "Parent: Unable to write duplicated socket %d to the child.",
nsd);
574 "Parent: Failed to get the current path");
584 "Parent: Failed to get full path of %s",
605 "Parent: Unable to create child stdin pipe.");
614 "Parent: Could not create ready event for child process");
623 "Parent: Could not create exit event for child process");
640 (
const char *
const *)
env,
attr, ptemp);
643 "Parent: Failed to create the child process.");
652 "Parent: Created child process %d",
new_child.pid);
752#define NUM_WAIT_HANDLES 3
753#define CHILD_HANDLE 0
754#define SHUTDOWN_HANDLE 1
755#define RESTART_HANDLE 2
777 "master_main: create child process failed. Exiting.");
801 "master_main: WaitForMultipleObjects WAIT_FAILED -- doing server shutdown");
807 "master_main: WaitForMultipleObjects with INFINITE wait exited with WAIT_TIMEOUT");
814 "Parent: Received shutdown signal -- Shutting down the server.");
817 "ResetEvent(shutdown_event)");
826 "Parent: Received restart signal -- Restarting the server.");
829 "Parent: ResetEvent(restart_event) failed.");
833 "Parent: SetEvent for child process event %pp failed.",
853 "Parent: child process %lu exited with status %lu -- Aborting.",
861 "Parent: child process %lu exited with status %lu -- Restarting.",
897 "Parent: SetEvent for child process event %pp failed",
904 "Parent: Child process %lu exited successfully.",
child_pid);
910 "Parent: Forcing termination of child process %lu",
993#define SERVICE_UNSET (-1)
1038 && ((
osver.dwMajorVersion > 5)
1039 || ((
osver.dwMajorVersion == 5) && (
osver.dwMinorVersion > 0)))) {
1044 pid =
getenv(
"AP_PARENT_PID");
1094 "Child: Unable to retrieve my generation from the parent");
1131 "Failed to get the full path of %s", process->
argv[0]);
1153 sizeof(
const char *));
1204 while (
opt->ind <
opt->argc) {
1304 "Using ConfigArgs of the installed service "
1309 "No installed ConfigArgs for the service "
1345 fprintf(
stderr,
"Errors reported here must be corrected before the "
1346 "service can be started.\n");
1356 fprintf(
stderr,
"Errors reported here must be corrected before the "
1357 "service can be started.\n");
1390 "%s: Unable to start the service manager.",
1439 "WARNING: ThreadLimit of %d exceeds compile-time "
1440 "limit of %d threads, decreasing to %d.",
1444 "ThreadLimit of %d exceeds compile-time limit "
1445 "of %d, decreasing to match",
1453 "WARNING: ThreadLimit of %d not allowed, "
1457 "ThreadLimit of %d not allowed, increasing to 1",
1466 if (!first_thread_limit) {
1473 "changing ThreadLimit to %d from original value "
1474 "of %d not allowed during restart",
1483 "WARNING: ThreadsPerChild of %d exceeds ThreadLimit "
1484 "of %d threads, decreasing to %d. To increase, please "
1485 "see the ThreadLimit directive.",
1489 "ThreadsPerChild of %d exceeds ThreadLimit "
1490 "of %d, decreasing to match",
1498 "WARNING: ThreadsPerChild of %d not allowed, "
1502 "ThreadsPerChild of %d not allowed, increasing to 1",
1612 "%s: Unable to create the start_mutex.",
1654 NULL,
APLOGNO(00451)
"no listening sockets available, shutting down");
1685 "%s child: Unable to init the start_mutex.",
1717 "Child process is running");
1722 "Child process is exiting");
1729 "%s configured -- resuming normal operations",
1760 static const char *
const aszSucc[] = {
"core.c",
NULL};
Symbol export macros and hook functions.
Apache Listeners Library.
Apache Multi-Processing Module library.
#define WaitForMultipleObjects(d1, ah, b, d2)
#define GetCurrentProcess()
#define DuplicateHandle(h1, h2, h3, ph4, d1, b, d2)
#define WaitForSingleObject(h, d)
APR Miscellaneous library routines.
APR Command Arguments (getopt)
APR general purpose library routines.
APR Portability Routines.
APR Shared Memory Routines.
APR Thread Mutex Routines.
APR Thread and Process Library.
static apr_pool_t * pconf
static void child_main(int child_num_arg, int child_bucket)
#define DEFAULT_THREAD_LIMIT
static const char * set_thread_limit(cmd_parms *cmd, void *dummy, const char *arg)
static const char * set_threads_per_child(cmd_parms *cmd, void *dummy, const char *arg)
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
void ap_hook_post_config(ap_HOOK_post_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_DECLARE_MODULE(foo)
void ap_hook_open_logs(ap_HOOK_open_logs_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_check_config(ap_HOOK_check_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_pre_config(ap_HOOK_pre_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_child_init(ap_HOOK_child_init_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
const char * ap_get_server_built(void)
const char * ap_get_server_description(void)
#define APEXIT_CHILDFATAL
#define AP_SQ_MS_CREATE_PRE_CONFIG
int ap_exists_config_define(const char *name)
int ap_state_query(int query_code)
void ap_listen_pre_config(void)
ap_listen_rec * ap_listeners
int ap_setup_listeners(server_rec *s)
void ap_remove_pid(apr_pool_t *p, const char *fname)
void ap_log_mpm_common(server_rec *s)
void ap_log_pid(apr_pool_t *p, const char *fname)
void ap_log_command_line(apr_pool_t *p, server_rec *s)
#define AP_SERVER_BASEARGS
server_rec * ap_server_conf
void ap_run_child_status(server_rec *s, pid_t pid, ap_generation_t gen, int slot, mpm_child_status state)
void ap_hook_mpm(ap_HOOK_mpm_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define DEFAULT_THREADS_PER_CHILD
void mpm_start_child_console_handler(void)
apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc, char const *const *argv)
apr_status_t mpm_service_to_start(const char **display_name, apr_pool_t *p)
apr_status_t mpm_service_set_name(apr_pool_t *p, const char **display_name, const char *set_name)
void mpm_nt_eventlog_stderr_open(const char *display_name, apr_pool_t *p)
void mpm_signal_service(apr_pool_t *ptemp, int signal)
void hold_console_open_on_error(void)
void mpm_start_console_handler(void)
void ap_signal_parent(ap_signal_parent_e type)
void mpm_service_stopping(void)
apr_status_t mpm_service_uninstall(void)
#define AP_DEFAULT_SERVICE_NAME
apr_status_t mpm_service_started(void)
apr_proc_mutex_t * start_mutex
apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc, char const *const *argv, int reconfig)
apr_status_t mpm_merge_service_args(apr_pool_t *p, apr_array_header_t *args, int fixed_args)
@ SIGNAL_PARENT_RESTART_GRACEFUL
const char * ap_pid_fname
int ap_sys_privileges_handlers(int inc)
int ap_max_requests_per_child
void ap_hook_mpm_get_name(ap_HOOK_mpm_get_name_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_mpm_query(ap_HOOK_mpm_query_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
const char *const const char *const * aszSucc
#define APR_HOOK_REALLY_FIRST
#define HTTP_INTERNAL_SERVER_ERROR
#define MPM20_MODULE_STUFF
void * ap_malloc(size_t size) __attribute__((malloc))
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
#define apr_get_netos_error()
#define apr_get_os_error()
#define APR_FILEPATH_TRUENAME
apr_array_header_t ** result
int strcasecmp(const char *a, const char *b)
char const *const char const *const ** env
#define apr_pcalloc(p, size)
apr_int32_t apr_int32_t apr_int32_t err
const char const char *const const char *const apr_procattr_t * attr
const char const char *const * args
#define AP_MPMQ_IS_FORKED
#define AP_MPMQ_MPM_STATE
#define AP_MPMQ_MAX_DAEMON_USED
#define AP_MPMQ_MAX_SPARE_DAEMONS
#define AP_MPMQ_MIN_SPARE_THREADS
#define AP_MPMQ_HARD_LIMIT_THREADS
#define AP_MPMQ_IS_THREADED
#define AP_MPMQ_MAX_THREADS
#define AP_MPMQ_MAX_REQUESTS_DAEMON
#define AP_MPMQ_MAX_SPARE_THREADS
#define AP_MPMQ_GENERATION
#define AP_MPMQ_MAX_DAEMONS
#define AP_MPMQ_HARD_LIMIT_DAEMONS
#define AP_MPMQ_MIN_SPARE_DAEMONS
#define AP_MPMQ_NOT_SUPPORTED
static apr_pool_t * pchild
Apache connection library.
Multi-Processing Modules functions.
static int ap_threads_per_child
static void restart(void)
#define HARD_SERVER_LIMIT
static int volatile restart_pending
static int volatile shutdown_pending
Apache scoreboard library.
int ap_run_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
scoreboard * ap_scoreboard_image
void ap_init_scoreboard(void *shared_score)
apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached)
int ap_update_child_status_from_indexes(int child_num, int thread_num, int status, request_rec *r)
apr_array_header_t * mpm_new_argv
Apache's listeners record.
ap_generation_t running_generation
A structure that represents one process.
ap_generation_t generation
A structure to store information for each virtual server.
apr_status_t apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock)
apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, apr_pool_t *cont)
apr_status_t apr_socket_close(apr_socket_t *thesocket)
typedef HANDLE(WINAPI *apr_winapi_fpt_CreateToolhelp32Snapshot)(DWORD dwFlags
typedef DWORD(WINAPI *apr_winapi_fpt_GetCompressedFileSizeA)(IN LPCSTR lpFileName