mpm_common.h revision fda1a61aacb6950953b7393b845b0639d8e87359
b66914021bd429f41311d2909a7e9289866da7fdnd/* Licensed to the Apache Software Foundation (ASF) under one or more
b51bf223f42d43ca6b1b33c95124edcfa5a871a4nd * contributor license agreements. See the NOTICE file distributed with
9963f91528694fb21e93da8584c31f226c6de97akess * this work for additional information regarding copyright ownership.
b66914021bd429f41311d2909a7e9289866da7fdnd * The ASF licenses this file to You under the Apache License, Version 2.0
b66914021bd429f41311d2909a7e9289866da7fdnd * (the "License"); you may not use this file except in compliance with
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz * the License. You may obtain a copy of the License at
b66914021bd429f41311d2909a7e9289866da7fdnd * Unless required by applicable law or agreed to in writing, software
b66914021bd429f41311d2909a7e9289866da7fdnd * distributed under the License is distributed on an "AS IS" BASIS,
b66914021bd429f41311d2909a7e9289866da7fdnd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b66914021bd429f41311d2909a7e9289866da7fdnd * See the License for the specific language governing permissions and
b66914021bd429f41311d2909a7e9289866da7fdnd * limitations under the License.
b66914021bd429f41311d2909a7e9289866da7fdnd/* The purpose of this file is to store the code that MOST mpm's will need
b66914021bd429f41311d2909a7e9289866da7fdnd * this does not mean a function only goes into this file if every MPM needs
b66914021bd429f41311d2909a7e9289866da7fdnd * it. It means that if a function is needed by more than one MPM, and
b66914021bd429f41311d2909a7e9289866da7fdnd * future maintenance would be served by making the code common, then the
b66914021bd429f41311d2909a7e9289866da7fdnd * function belongs here.
eed2a23d9b5986937f1e2b1c120be97744508a72nd * This is going in src/main because it is not platform specific, it is
eed2a23d9b5986937f1e2b1c120be97744508a72nd * specific to multi-process servers, but NOT to Unix. Which is why it
eed2a23d9b5986937f1e2b1c120be97744508a72nd * does not belong in src/os/unix
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @brief Multi-Processing Modules functions
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @defgroup APACHE_MPM Multi-Processing Modules
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @ingroup APACHE
eed2a23d9b5986937f1e2b1c120be97744508a72ndextern "C" {
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* The maximum length of the queue of pending connections, as defined
eed2a23d9b5986937f1e2b1c120be97744508a72nd * by listen(2). Under some systems, it should be increased if you
eed2a23d9b5986937f1e2b1c120be97744508a72nd * are experiencing a heavy TCP SYN flood attack.
eed2a23d9b5986937f1e2b1c120be97744508a72nd * It defaults to 511 instead of 512 because some systems store it
eed2a23d9b5986937f1e2b1c120be97744508a72nd * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is
eed2a23d9b5986937f1e2b1c120be97744508a72nd * 255 when truncated.
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* Signal used to gracefully restart */
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* Signal used to gracefully restart (without SIG prefix) */
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* Signal used to gracefully restart (as a quoted string) */
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* Signal used to gracefully stop */
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* Signal used to gracefully stop (without SIG prefix) */
eed2a23d9b5986937f1e2b1c120be97744508a72nd/* Signal used to gracefully stop (as a quoted string) */
eed2a23d9b5986937f1e2b1c120be97744508a72nd * Make sure all child processes that have been spawned by the parent process
eed2a23d9b5986937f1e2b1c120be97744508a72nd * have died. This includes process registered as "other_children".
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @param terminate Either 1 or 0. If 1, send the child processes SIGTERM
eed2a23d9b5986937f1e2b1c120be97744508a72nd * each time through the loop. If 0, give the process time to die
eed2a23d9b5986937f1e2b1c120be97744508a72nd * on its own before signalling it.
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @tip This function requires that some macros are defined by the MPM: <pre>
eed2a23d9b5986937f1e2b1c120be97744508a72nd * MPM_CHILD_PID -- Get the pid from the specified spot in the scoreboard
eed2a23d9b5986937f1e2b1c120be97744508a72nd * MPM_NOTE_CHILD_KILLED -- Note the child died in the scoreboard
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @tip The MPM child processes which are reclaimed are those listed
eed2a23d9b5986937f1e2b1c120be97744508a72nd * in the scoreboard as well as those currently registered via
eed2a23d9b5986937f1e2b1c120be97744508a72nd * ap_register_extra_mpm_process().
eed2a23d9b5986937f1e2b1c120be97744508a72nd * Catch any child processes that have been spawned by the parent process
b51bf223f42d43ca6b1b33c95124edcfa5a871a4nd * which have exited. This includes processes registered as "other_children".
b51bf223f42d43ca6b1b33c95124edcfa5a871a4nd * @tip This function requires that some macros are defined by the MPM: <pre>
eed2a23d9b5986937f1e2b1c120be97744508a72nd * MPM_CHILD_PID -- Get the pid from the specified spot in the scoreboard
eed2a23d9b5986937f1e2b1c120be97744508a72nd * MPM_NOTE_CHILD_KILLED -- Note the child died in the scoreboard
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @tip The MPM child processes which are relieved are those listed
eed2a23d9b5986937f1e2b1c120be97744508a72nd * in the scoreboard as well as those currently registered via
eed2a23d9b5986937f1e2b1c120be97744508a72nd * ap_register_extra_mpm_process().
eed2a23d9b5986937f1e2b1c120be97744508a72nd * Tell ap_reclaim_child_processes() and ap_relieve_child_processes() about
eed2a23d9b5986937f1e2b1c120be97744508a72nd * an MPM child process which has no entry in the scoreboard.
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @param pid The process id of an MPM child process which should be
eed2a23d9b5986937f1e2b1c120be97744508a72nd * reclaimed when ap_reclaim_child_processes() is called.
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @tip If an extra MPM child process terminates prior to calling
eed2a23d9b5986937f1e2b1c120be97744508a72nd * ap_reclaim_child_processes(), remove it from the list of such processes
eed2a23d9b5986937f1e2b1c120be97744508a72nd * by calling ap_unregister_extra_mpm_process().
eed2a23d9b5986937f1e2b1c120be97744508a72nd * Unregister an MPM child process which was previously registered by a
eed2a23d9b5986937f1e2b1c120be97744508a72nd * call to ap_register_extra_mpm_process().
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @param pid The process id of an MPM child process which no longer needs to
eed2a23d9b5986937f1e2b1c120be97744508a72nd * be reclaimed.
eed2a23d9b5986937f1e2b1c120be97744508a72nd * @return 1 if the process was found and removed, 0 otherwise
apr_pool_t *p);
#if defined(TCP_NODELAY)
#ifdef HAVE_GETPWNAM
#ifdef HAVE_GETGRNAM
struct ap_pod_t {
apr_pool_t *p;
extern int ap_max_requests_per_child;
const char *arg);
extern const char *ap_pid_fname;
const char *arg);
extern const char *ap_lock_fname;
const char *arg);
const char *arg);
const char *arg);
extern int ap_coredumpdir_configured;
const char *arg);
extern int ap_graceful_shutdown_timeout;
const char *arg);
#define AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND \
const char *arg);
const char *arg);
const char *arg);
#ifdef __cplusplus