Blame include/mpm_common.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/* The purpose of this file is to store the code that MOST mpm's will need
Packit 90a5c9
 * this does not mean a function only goes into this file if every MPM needs
Packit 90a5c9
 * it.  It means that if a function is needed by more than one MPM, and
Packit 90a5c9
 * future maintenance would be served by making the code common, then the
Packit 90a5c9
 * function belongs here.
Packit 90a5c9
 *
Packit 90a5c9
 * This is going in src/main because it is not platform specific, it is
Packit 90a5c9
 * specific to multi-process servers, but NOT to Unix.  Which is why it
Packit 90a5c9
 * does not belong in src/os/unix
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * @file  mpm_common.h
Packit 90a5c9
 * @brief Multi-Processing Modules functions
Packit 90a5c9
 *
Packit 90a5c9
 * @defgroup APACHE_MPM Multi-Processing Modules
Packit 90a5c9
 * @ingroup  APACHE
Packit 90a5c9
 * @{
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef APACHE_MPM_COMMON_H
Packit 90a5c9
#define APACHE_MPM_COMMON_H
Packit 90a5c9
Packit 90a5c9
#include "ap_config.h"
Packit 90a5c9
#include "ap_mpm.h"
Packit 90a5c9
#include "scoreboard.h"
Packit 90a5c9
Packit 90a5c9
#if APR_HAVE_NETINET_TCP_H
Packit 90a5c9
#include <netinet/tcp.h>    /* for TCP_NODELAY */
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#include "apr_proc_mutex.h"
Packit 90a5c9
Packit 90a5c9
#ifdef __cplusplus
Packit 90a5c9
extern "C" {
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/* The maximum length of the queue of pending connections, as defined
Packit 90a5c9
 * by listen(2).  Under some systems, it should be increased if you
Packit 90a5c9
 * are experiencing a heavy TCP SYN flood attack.
Packit 90a5c9
 *
Packit 90a5c9
 * It defaults to 511 instead of 512 because some systems store it
Packit 90a5c9
 * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is
Packit 90a5c9
 * 255 when truncated.
Packit 90a5c9
 */
Packit 90a5c9
#ifndef DEFAULT_LISTENBACKLOG
Packit 90a5c9
#define DEFAULT_LISTENBACKLOG 511
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/* Signal used to gracefully restart */
Packit 90a5c9
#define AP_SIG_GRACEFUL SIGUSR1
Packit 90a5c9
Packit 90a5c9
/* Signal used to gracefully restart (without SIG prefix) */
Packit 90a5c9
#define AP_SIG_GRACEFUL_SHORT USR1
Packit 90a5c9
Packit 90a5c9
/* Signal used to gracefully restart (as a quoted string) */
Packit 90a5c9
#define AP_SIG_GRACEFUL_STRING "SIGUSR1"
Packit 90a5c9
Packit 90a5c9
/* Signal used to gracefully stop */
Packit 90a5c9
#define AP_SIG_GRACEFUL_STOP SIGWINCH
Packit 90a5c9
Packit 90a5c9
/* Signal used to gracefully stop (without SIG prefix) */
Packit 90a5c9
#define AP_SIG_GRACEFUL_STOP_SHORT WINCH
Packit 90a5c9
Packit 90a5c9
/* Signal used to gracefully stop (as a quoted string) */
Packit 90a5c9
#define AP_SIG_GRACEFUL_STOP_STRING "SIGWINCH"
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Callback function used for ap_reclaim_child_processes() and
Packit 90a5c9
 * ap_relieve_child_processes().  The callback function will be
Packit 90a5c9
 * called for each terminated child process.
Packit 90a5c9
 */
Packit 90a5c9
typedef void ap_reclaim_callback_fn_t(int childnum, pid_t pid,
Packit 90a5c9
                                      ap_generation_t gen);
Packit 90a5c9
Packit 90a5c9
#if (!defined(WIN32) && !defined(NETWARE)) || defined(DOXYGEN)
Packit 90a5c9
/**
Packit 90a5c9
 * Make sure all child processes that have been spawned by the parent process
Packit 90a5c9
 * have died.  This includes process registered as "other_children".
Packit 90a5c9
 *
Packit 90a5c9
 * @param terminate Either 1 or 0.  If 1, send the child processes SIGTERM
Packit 90a5c9
 *        each time through the loop.  If 0, give the process time to die
Packit 90a5c9
 *        on its own before signalling it.
Packit 90a5c9
 * @param mpm_callback Callback invoked for each dead child process
Packit 90a5c9
 *
Packit 90a5c9
 * @note The MPM child processes which are reclaimed are those listed
Packit 90a5c9
 * in the scoreboard as well as those currently registered via
Packit 90a5c9
 * ap_register_extra_mpm_process().
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_reclaim_child_processes(int terminate,
Packit 90a5c9
                                            ap_reclaim_callback_fn_t *mpm_callback);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Catch any child processes that have been spawned by the parent process
Packit 90a5c9
 * which have exited. This includes processes registered as "other_children".
Packit 90a5c9
 *
Packit 90a5c9
 * @param mpm_callback Callback invoked for each dead child process
Packit 90a5c9
Packit 90a5c9
 * @note The MPM child processes which are relieved are those listed
Packit 90a5c9
 * in the scoreboard as well as those currently registered via
Packit 90a5c9
 * ap_register_extra_mpm_process().
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Tell ap_reclaim_child_processes() and ap_relieve_child_processes() about
Packit 90a5c9
 * an MPM child process which has no entry in the scoreboard.
Packit 90a5c9
 * @param pid The process id of an MPM child process which should be
Packit 90a5c9
 * reclaimed when ap_reclaim_child_processes() is called.
Packit 90a5c9
 * @param gen The generation of this MPM child process.
Packit 90a5c9
 *
Packit 90a5c9
 * @note If an extra MPM child process terminates prior to calling
Packit 90a5c9
 * ap_reclaim_child_processes(), remove it from the list of such processes
Packit 90a5c9
 * by calling ap_unregister_extra_mpm_process().
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Unregister an MPM child process which was previously registered by a
Packit 90a5c9
 * call to ap_register_extra_mpm_process().
Packit 90a5c9
 * @param pid The process id of an MPM child process which no longer needs to
Packit 90a5c9
 * be reclaimed.
Packit 90a5c9
 * @param old_gen Set to the server generation of the process, if found.
Packit 90a5c9
 * @return 1 if the process was found and removed, 0 otherwise
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(int) ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *old_gen);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Safely signal an MPM child process, if the process is in the
Packit 90a5c9
 * current process group.  Otherwise fail.
Packit 90a5c9
 * @param pid the process id of a child process to signal
Packit 90a5c9
 * @param sig the signal number to send
Packit 90a5c9
 * @return APR_SUCCESS if signal is sent, otherwise an error as per kill(3);
Packit 90a5c9
 * APR_EINVAL is returned if passed either an invalid (< 1) pid, or if
Packit 90a5c9
 * the pid is not in the current process group
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_safe_kill(pid_t pid, int sig);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Log why a child died to the error log, if the child died without the
Packit 90a5c9
 * parent signalling it.
Packit 90a5c9
 * @param pid The child that has died
Packit 90a5c9
 * @param why The return code of the child process
Packit 90a5c9
 * @param status The status returned from ap_wait_or_timeout
Packit 90a5c9
 * @return 0 on success, APEXIT_CHILDFATAL if MPM should terminate
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(int) ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status);
Packit 90a5c9
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s, apr_pool_t *in_pconf);
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_fatal_signal_child_setup(server_rec *s);
Packit 90a5c9
Packit 90a5c9
#endif /* (!WIN32 && !NETWARE) || DOXYGEN */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Pool cleanup for end-generation hook implementation
Packit 90a5c9
 * (core httpd function)
Packit 90a5c9
 */
Packit 90a5c9
apr_status_t ap_mpm_end_gen_helper(void *unused);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Run the monitor hook (once every ten calls), determine if any child
Packit 90a5c9
 * process has died and, if none died, sleep one second.
Packit 90a5c9
 * @param status The return code if a process has died
Packit 90a5c9
 * @param exitcode The returned exit status of the child, if a child process
Packit 90a5c9
 *                 dies, or the signal that caused the child to die.
Packit 90a5c9
 * @param ret The process id of the process that died
Packit 90a5c9
 * @param p The pool to allocate out of
Packit 90a5c9
 * @param s The server_rec to pass
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode,
Packit 90a5c9
                                    apr_proc_t *ret, apr_pool_t *p, 
Packit 90a5c9
                                    server_rec *s);
Packit 90a5c9
Packit 90a5c9
#if defined(TCP_NODELAY)
Packit 90a5c9
/**
Packit 90a5c9
 * Turn off the nagle algorithm for the specified socket.  The nagle algorithm
Packit 90a5c9
 * says that we should delay sending partial packets in the hopes of getting
Packit 90a5c9
 * more data.  There are bad interactions between persistent connections and
Packit 90a5c9
 * Nagle's algorithm that have severe performance penalties.
Packit 90a5c9
 * @param s The socket to disable nagle for.
Packit 90a5c9
 */
Packit 90a5c9
void ap_sock_disable_nagle(apr_socket_t *s);
Packit 90a5c9
#else
Packit 90a5c9
#define ap_sock_disable_nagle(s)        /* NOOP */
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#ifdef HAVE_GETPWNAM
Packit 90a5c9
/**
Packit 90a5c9
 * Convert a username to a numeric ID
Packit 90a5c9
 * @param name The name to convert
Packit 90a5c9
 * @return The user id corresponding to a name
Packit 90a5c9
 * @fn uid_t ap_uname2id(const char *name)
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(uid_t) ap_uname2id(const char *name);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#ifdef HAVE_GETGRNAM
Packit 90a5c9
/**
Packit 90a5c9
 * Convert a group name to a numeric ID
Packit 90a5c9
 * @param name The name to convert
Packit 90a5c9
 * @return The group id corresponding to a name
Packit 90a5c9
 * @fn gid_t ap_gname2id(const char *name)
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(gid_t) ap_gname2id(const char *name);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#ifndef HAVE_INITGROUPS
Packit 90a5c9
/**
Packit 90a5c9
 * The initgroups() function initializes the group access list by reading the
Packit 90a5c9
 * group database /etc/group and using all groups of which user is a member.
Packit 90a5c9
 * The additional group basegid is also added to the list.
Packit 90a5c9
 * @param name The user name - must be non-NULL
Packit 90a5c9
 * @param basegid The basegid to add
Packit 90a5c9
 * @return returns 0 on success
Packit 90a5c9
 * @fn int initgroups(const char *name, gid_t basegid)
Packit 90a5c9
 */
Packit 90a5c9
int initgroups(const char *name, gid_t basegid);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if (!defined(WIN32) && !defined(NETWARE)) || defined(DOXYGEN)
Packit 90a5c9
Packit 90a5c9
typedef struct ap_pod_t ap_pod_t;
Packit 90a5c9
Packit 90a5c9
struct ap_pod_t {
Packit 90a5c9
    apr_file_t *pod_in;
Packit 90a5c9
    apr_file_t *pod_out;
Packit 90a5c9
    apr_pool_t *p;
Packit 90a5c9
};
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Open the pipe-of-death.  The pipe of death is used to tell all child
Packit 90a5c9
 * processes that it is time to die gracefully.
Packit 90a5c9
 * @param p The pool to use for allocating the pipe
Packit 90a5c9
 * @param pod the pipe-of-death that is created.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Check the pipe to determine if the process has been signalled to die.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_pod_check(ap_pod_t *pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Close the pipe-of-death
Packit 90a5c9
 *
Packit 90a5c9
 * @param pod the pipe-of-death to close.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Write data to the pipe-of-death, signalling that one child process
Packit 90a5c9
 * should die.
Packit 90a5c9
 * @param pod the pipe-of-death to write to.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Write data to the pipe-of-death, signalling that all child process
Packit 90a5c9
 * should die.
Packit 90a5c9
 * @param pod The pipe-of-death to write to.
Packit 90a5c9
 * @param num The number of child processes to kill
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num);
Packit 90a5c9
Packit 90a5c9
#define AP_MPM_PODX_RESTART_CHAR '$'
Packit 90a5c9
#define AP_MPM_PODX_GRACEFUL_CHAR '!'
Packit 90a5c9
Packit 90a5c9
typedef enum { AP_MPM_PODX_NORESTART, AP_MPM_PODX_RESTART, AP_MPM_PODX_GRACEFUL } ap_podx_restart_t;
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Open the extended pipe-of-death.
Packit 90a5c9
 * @param p The pool to use for allocating the pipe
Packit 90a5c9
 * @param pod The pipe-of-death that is created.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_podx_open(apr_pool_t *p, ap_pod_t **pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Check the extended pipe to determine if the process has been signalled to die.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(int) ap_mpm_podx_check(ap_pod_t *pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Close the pipe-of-death
Packit 90a5c9
 *
Packit 90a5c9
 * @param pod The pipe-of-death to close.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_podx_close(ap_pod_t *pod);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Write data to the extended pipe-of-death, signalling that one child process
Packit 90a5c9
 * should die.
Packit 90a5c9
 * @param pod the pipe-of-death to write to.
Packit 90a5c9
 * @param graceful restart-type
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(apr_status_t) ap_mpm_podx_signal(ap_pod_t *pod,
Packit 90a5c9
                                            ap_podx_restart_t graceful);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Write data to the extended pipe-of-death, signalling that all child process
Packit 90a5c9
 * should die.
Packit 90a5c9
 * @param pod The pipe-of-death to write to.
Packit 90a5c9
 * @param num The number of child processes to kill
Packit 90a5c9
 * @param graceful restart-type
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(void) ap_mpm_podx_killpg(ap_pod_t *pod, int num,
Packit 90a5c9
                                    ap_podx_restart_t graceful);
Packit 90a5c9
Packit 90a5c9
#endif /* (!WIN32 && !NETWARE) || DOXYGEN */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Check that exactly one MPM is loaded
Packit 90a5c9
 * Returns NULL if yes, error string if not.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE(const char *) ap_check_mpm(void);
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * These data members are common to all mpms. Each new mpm
Packit 90a5c9
 * should either use the appropriate ap_mpm_set_* function
Packit 90a5c9
 * in their command table or create their own for custom or
Packit 90a5c9
 * OS specific needs. These should work for most.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * The maximum number of requests each child thread or
Packit 90a5c9
 * process handles before dying off
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_DATA extern int ap_max_requests_per_child;
Packit 90a5c9
const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                                    const char *arg);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * The filename used to store the process id.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_DATA extern const char *ap_pid_fname;
Packit 90a5c9
const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                               const char *arg);
Packit 90a5c9
void ap_mpm_dump_pidfile(apr_pool_t *p, apr_file_t *out);
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * The directory that the server changes directory to dump core.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_DATA extern char ap_coredump_dir[MAX_STRING_LEN];
Packit 90a5c9
AP_DECLARE_DATA extern int ap_coredumpdir_configured;
Packit 90a5c9
const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                                   const char *arg);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Set the timeout period for a graceful shutdown.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_DATA extern int ap_graceful_shutdown_timeout;
Packit 90a5c9
AP_DECLARE(const char *)ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                                         const char *arg);
Packit 90a5c9
#define AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND \
Packit 90a5c9
AP_INIT_TAKE1("GracefulShutdownTimeout", ap_mpm_set_graceful_shutdown, NULL, \
Packit 90a5c9
              RSRC_CONF, "Maximum time in seconds to wait for child "        \
Packit 90a5c9
              "processes to complete transactions during shutdown")
Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
int ap_signal_server(int *, apr_pool_t *);
Packit 90a5c9
void ap_mpm_rewrite_args(process_rec *);
Packit 90a5c9
Packit 90a5c9
AP_DECLARE_DATA extern apr_uint32_t ap_max_mem_free;
Packit 90a5c9
extern const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                                           const char *arg);
Packit 90a5c9
Packit 90a5c9
AP_DECLARE_DATA extern apr_size_t ap_thread_stacksize;
Packit 90a5c9
extern const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                                               const char *arg);
Packit 90a5c9
Packit 90a5c9
/* core's implementation of child_status hook */
Packit 90a5c9
extern void ap_core_child_status(server_rec *s, pid_t pid, ap_generation_t gen,
Packit 90a5c9
                                 int slot, mpm_child_status status);
Packit 90a5c9
Packit 90a5c9
#if defined(AP_ENABLE_EXCEPTION_HOOK) && AP_ENABLE_EXCEPTION_HOOK
Packit 90a5c9
extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
Packit 90a5c9
                                             const char *arg);
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p, server_rec *s))
Packit 90a5c9
Packit 90a5c9
/* register modules that undertake to manage system security */
Packit 90a5c9
AP_DECLARE(int) ap_sys_privileges_handlers(int inc);
Packit 90a5c9
AP_DECLARE_HOOK(int, drop_privileges, (apr_pool_t * pchild, server_rec * s))
Packit 90a5c9
Packit 90a5c9
/* implement the ap_mpm_query() function
Packit 90a5c9
 * The MPM should return OK+APR_ENOTIMPL for any unimplemented query codes;
Packit 90a5c9
 * modules which intercede for specific query codes should DECLINE for others.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_HOOK(int, mpm_query, (int query_code, int *result, apr_status_t *rv))
Packit 90a5c9
Packit 90a5c9
/* register the specified callback */
Packit 90a5c9
AP_DECLARE_HOOK(apr_status_t, mpm_register_timed_callback,
Packit 90a5c9
                (apr_time_t t, ap_mpm_callback_fn_t *cbfn, void *baton))
Packit 90a5c9
Packit 90a5c9
/* get MPM name (e.g., "prefork" or "event") */
Packit 90a5c9
AP_DECLARE_HOOK(const char *,mpm_get_name,(void))
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Notification that connection handling is suspending (disassociating from the
Packit 90a5c9
 * current thread)
Packit 90a5c9
 * @param c The current connection
Packit 90a5c9
 * @param r The current request, or NULL if there is no active request
Packit 90a5c9
 * @ingroup hooks
Packit 90a5c9
 * @see ap_hook_resume_connection
Packit 90a5c9
 * @note This hook is not implemented by MPMs like Prefork and Worker which 
Packit 90a5c9
 * handle all processing of a particular connection on the same thread.
Packit 90a5c9
 * @note This hook will be called on the thread that was previously
Packit 90a5c9
 * processing the connection.
Packit 90a5c9
 * @note This hook is not called at the end of connection processing.  This
Packit 90a5c9
 * hook only notifies a module when processing of an active connection is
Packit 90a5c9
 * suspended.
Packit 90a5c9
 * @note Resumption and subsequent suspension of a connection solely to perform
Packit 90a5c9
 * I/O by the MPM, with no execution of non-MPM code, may not necessarily result
Packit 90a5c9
 * in a call to this hook.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_HOOK(void, suspend_connection,
Packit 90a5c9
                (conn_rec *c, request_rec *r))
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Notification that connection handling is resuming (associating with a thread)
Packit 90a5c9
 * @param c The current connection
Packit 90a5c9
 * @param r The current request, or NULL if there is no active request
Packit 90a5c9
 * @ingroup hooks
Packit 90a5c9
 * @see ap_hook_suspend_connection
Packit 90a5c9
 * @note This hook is not implemented by MPMs like Prefork and Worker which 
Packit 90a5c9
 * handle all processing of a particular connection on the same thread.
Packit 90a5c9
 * @note This hook will be called on the thread that will resume processing
Packit 90a5c9
 * the connection.
Packit 90a5c9
 * @note This hook is not called at the beginning of connection processing.
Packit 90a5c9
 * This hook only notifies a module when processing resumes for a
Packit 90a5c9
 * previously-suspended connection.
Packit 90a5c9
 * @note Resumption and subsequent suspension of a connection solely to perform
Packit 90a5c9
 * I/O by the MPM, with no execution of non-MPM code, may not necessarily result
Packit 90a5c9
 * in a call to this hook.
Packit 90a5c9
 */
Packit 90a5c9
AP_DECLARE_HOOK(void, resume_connection,
Packit 90a5c9
                (conn_rec *c, request_rec *r))
Packit 90a5c9
Packit 90a5c9
/* mutex type string for accept mutex, if any; MPMs should use the
Packit 90a5c9
 * same mutex type for ease of configuration
Packit 90a5c9
 */
Packit 90a5c9
#define AP_ACCEPT_MUTEX_TYPE "mpm-accept"
Packit 90a5c9
Packit 90a5c9
/* internal pre-config logic for MPM-related settings, callable only from
Packit 90a5c9
 * core's pre-config hook
Packit 90a5c9
 */
Packit 90a5c9
void mpm_common_pre_config(apr_pool_t *pconf);
Packit 90a5c9
Packit 90a5c9
#ifdef __cplusplus
Packit 90a5c9
}
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#endif /* !APACHE_MPM_COMMON_H */
Packit 90a5c9
/** @} */