Apache HTTPD
Classes | Macros | Typedefs | Enumerations | Functions | Variables
event.c File Reference
#include "apr.h"
#include "apr_portable.h"
#include "apr_strings.h"
#include "apr_file_io.h"
#include "apr_thread_proc.h"
#include "apr_signal.h"
#include "apr_thread_mutex.h"
#include "apr_poll.h"
#include "apr_ring.h"
#include "apr_queue.h"
#include "apr_atomic.h"
#include "apr_want.h"
#include "apr_version.h"
#include <stdlib.h>
#include "ap_config.h"
#include "httpd.h"
#include "http_main.h"
#include "http_log.h"
#include "http_config.h"
#include "http_core.h"
#include "http_connection.h"
#include "http_protocol.h"
#include "ap_mpm.h"
#include "mpm_common.h"
#include "ap_listen.h"
#include "scoreboard.h"
#include "mpm_fdqueue.h"
#include "mpm_default.h"
#include "http_vhost.h"
#include "unixd.h"
#include "apr_skiplist.h"
#include <signal.h>
#include <limits.h>

Go to the source code of this file.

Classes

struct  event_conn_state_t
 
struct  timeout_head_t
 
struct  timeout_queue
 
struct  proc_info
 
struct  thread_starter
 
struct  listener_poll_type
 
struct  event_retained_data
 
struct  event_child_bucket
 
struct  event_srv_cfg_s
 

Macros

#define APR_WANT_STRFUNC
 
#define DEFAULT_SERVER_LIMIT   16
 
#define MAX_SERVER_LIMIT   20000
 
#define DEFAULT_THREAD_LIMIT   64
 
#define MAX_THREAD_LIMIT   100000
 
#define MPM_CHILD_PID(i)   (ap_scoreboard_image->parent[i].pid)
 
#define MAX_SECS_TO_LINGER   30
 
#define SECONDS_TO_LINGER   2
 
#define DEFAULT_WORKER_FACTOR   2
 
#define WORKER_FACTOR_SCALE   16 /* scale factor to allow fractional values */
 
#define TIMEOUT_FUDGE_FACTOR   apr_time_from_msec(100)
 
#define TO_QUEUE_ELEM_INIT(el)    APR_RING_ELEM_INIT((el), timeout_list)
 
#define MAX_SPAWN_RATE   (32)
 
#define ID_FROM_CHILD_THREAD(c, t)   ((c * thread_limit) + t)
 
#define LISTENER_SIGNAL   SIGHUP
 
#define close_socket_nonblocking(csd)    close_socket_nonblocking_(csd, __FUNCTION__, __LINE__)
 
#define ST_INIT   0
 
#define ST_GRACEFUL   1
 
#define ST_UNGRACEFUL   2
 
#define EVENT_FUDGE_FACTOR   apr_time_from_msec(10)
 
#define LINGERING_BUF_SIZE   (32 * 1024)
 
#define NON_WAKEABLE_POLL_TIMEOUT   apr_time_from_msec(100)
 

Typedefs

typedef struct event_srv_cfg_s event_srv_cfg
 
typedef struct event_conn_state_t event_conn_state_t
 
typedef struct event_retained_data event_retained_data
 
typedef struct event_child_bucket event_child_bucket
 

Enumerations

enum  poll_type_e { PT_CSD , PT_ACCEPT }
 

Functions

static void TO_QUEUE_APPEND (struct timeout_queue *q, event_conn_state_t *el)
 
static void TO_QUEUE_REMOVE (struct timeout_queue *q, event_conn_state_t *el)
 
static struct timeout_queueTO_QUEUE_MAKE (apr_pool_t *p, apr_time_t t, struct timeout_queue *ref)
 
static void disable_listensocks (void)
 
static void enable_listensocks (void)
 
static APR_INLINE apr_uint32_t listeners_disabled (void)
 
static APR_INLINE int connections_above_limit (int *busy)
 
static APR_INLINE int should_enable_listensocks (void)
 
static void close_socket_nonblocking_ (apr_socket_t *csd, const char *from, int line)
 
static void close_worker_sockets (void)
 
static void wakeup_listener (void)
 
static void signal_threads (int mode)
 
static int event_query (int query_code, int *result, apr_status_t *rv)
 
static void event_note_child_stopped (int slot, pid_t pid, ap_generation_t gen)
 
static void event_note_child_started (int slot, pid_t pid)
 
static const charevent_get_name (void)
 
static void clean_child_exit (int code) __attribute__((noreturn))
 
static void just_die (int sig)
 
static apr_status_t decrement_connection_count (void *cs_)
 
static void notify_suspend (event_conn_state_t *cs)
 
static void notify_resume (event_conn_state_t *cs, int cleanup)
 
static int defer_lingering_close (event_conn_state_t *cs)
 
static void close_connection (event_conn_state_t *cs)
 
static int shutdown_connection (event_conn_state_t *cs)
 
static apr_status_t ptrans_pre_cleanup (void *dummy)
 
static apr_status_t event_request_cleanup (void *dummy)
 
static void event_pre_read_request (request_rec *r, conn_rec *c)
 
static int event_post_read_request (request_rec *r)
 
static void process_lingering_close (event_conn_state_t *cs)
 
static void update_reqevents_from_sense (event_conn_state_t *cs, int sense)
 
static void process_socket (apr_thread_t *thd, apr_pool_t *p, apr_socket_t *sock, event_conn_state_t *cs, int my_child_num, int my_thread_num)
 
static void check_infinite_requests (void)
 
static int close_listeners (int *closed)
 
static void unblock_signal (int sig)
 
static void dummy_signal_handler (int sig)
 
static apr_status_t push_timer2worker (timer_event_t *te)
 
static apr_status_t push2worker (event_conn_state_t *cs, apr_socket_t *csd, apr_pool_t *ptrans)
 
static void get_worker (int *have_idle_worker_p, int blocking, int *all_busy)
 
static int timer_comp (void *a, void *b)
 
static apr_status_t event_register_timed_callback (apr_time_t t, ap_mpm_callback_fn_t *cbfn, void *baton)
 
static void process_timeout_queue (struct timeout_queue *q, apr_time_t expiry, int(*func)(event_conn_state_t *))
 
static void process_keepalive_queue (apr_time_t expiry)
 
static void *APR_THREAD_FUNC listener_thread (apr_thread_t *thd, void *dummy)
 
static int worker_thread_should_exit_early (void)
 
static void *APR_THREAD_FUNC worker_thread (apr_thread_t *thd, void *dummy)
 
static int check_signal (int signum)
 
static void create_listener_thread (thread_starter *ts)
 
static void setup_threads_runtime (void)
 
static void *APR_THREAD_FUNC start_threads (apr_thread_t *thd, void *dummy)
 
static void join_workers (apr_thread_t *listener, apr_thread_t **threads)
 
static void join_start_thread (apr_thread_t *start_thread_id)
 
static void child_main (int child_num_arg, int child_bucket)
 
static int make_child (server_rec *s, int slot, int bucket)
 
static void startup_children (int number_to_start)
 
static void perform_idle_server_maintenance (int child_bucket, int *max_daemon_used)
 
static void server_main_loop (int remaining_children_to_start)
 
static int event_run (apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
static void setup_slave_conn (conn_rec *c, void *csd)
 
static int event_pre_connection (conn_rec *c, void *csd)
 
static int event_protocol_switch (conn_rec *c, request_rec *r, server_rec *s, const char *protocol)
 
static int event_open_logs (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 
static int event_pre_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
 
static int event_post_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 
static int event_check_config (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 
static void event_hooks (apr_pool_t *p)
 
static const charset_daemons_to_start (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_min_spare_threads (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_max_spare_threads (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_max_workers (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_threads_per_child (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_server_limit (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_thread_limit (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charset_worker_factor (cmd_parms *cmd, void *dummy, const char *arg)
 

Variables

static unsigned int worker_factor = 2 * 16
 
static int threads_per_child = 0
 
static int ap_daemons_to_start = 0
 
static int min_spare_threads = 0
 
static int max_spare_threads = 0
 
static int active_daemons_limit = 0
 
static int max_workers = 0
 
static int server_limit = 0
 
static int thread_limit = 0
 
static int had_healthy_child = 0
 
static volatile int dying = 0
 
static volatile int workers_may_exit = 0
 
static volatile int start_thread_may_exit = 0
 
static volatile int listener_may_exit = 0
 
static int listener_is_wakeable = 0
 
static int num_listensocks = 0
 
static apr_int32_t conns_this_child
 
static apr_uint32_t connection_count = 0
 
static apr_uint32_t lingering_count = 0
 
static apr_uint32_t suspended_count = 0
 
static apr_uint32_t clogged_count = 0
 
static apr_uint32_t threads_shutdown = 0
 
static int resource_shortage = 0
 
static fd_queue_tworker_queue
 
static fd_queue_info_tworker_queue_info
 
static apr_thread_mutex_ttimeout_mutex
 
static apr_pollfd_tlistener_pollfd
 
static apr_pollset_tevent_pollset
 
static event_conn_state_t *volatile defer_linger_chain
 
static struct timeout_queuewrite_completion_q
 
static struct timeout_queuekeepalive_q
 
static struct timeout_queuelinger_q
 
static struct timeout_queueshort_linger_q
 
static volatile apr_time_t queues_next_expiry
 
static event_retained_dataretained
 
static event_child_bucketall_buckets
 
static event_child_bucketmy_bucket
 
static int one_process = 0
 
static apr_pool_tpconf
 
static apr_pool_tpchild
 
static apr_pool_tpruntime
 
static pid_t ap_my_pid
 
static pid_t parent_pid
 
static apr_os_thread_tlistener_os_thread
 
static int ap_child_slot
 
static apr_socket_t ** worker_sockets
 
static volatile apr_uint32_t listensocks_disabled
 
static int terminate_mode = 0
 
static int child_fatal
 
static timer_event_t timer_free_ring
 
static apr_skiplisttimer_skiplist
 
static volatile apr_time_t timers_next_expiry
 
static apr_thread_mutex_tg_timer_skiplist_mtx
 
static const command_rec event_cmds []
 
static int *const aplog_module_index = &( mpm_event_module.module_index)
 

Macro Definition Documentation

◆ APR_WANT_STRFUNC

#define APR_WANT_STRFUNC

This MPM tries to fix the 'keep alive problem' in HTTP.

After a client completes the first request, the client can keep the connection open to send more requests with the same socket. This can save significant overhead in creating TCP connections. However, the major disadvantage is that Apache traditionally keeps an entire child process/thread waiting for data from the client. To solve this problem, this MPM has a dedicated thread for handling both the Listening sockets, and all sockets that are in a Keep Alive status.

The MPM assumes the underlying apr_pollset implementation is somewhat threadsafe. This currently is only compatible with KQueue and EPoll. This enables the MPM to avoid extra high level locking or having to wake up the listener thread when a keep-alive socket needs to be sent to it.

This MPM does not perform well on older platforms that do not have very good threading, like Linux with a 2.4 kernel, but this does not matter, since we require EPoll or KQueue.

For FreeBSD, use 5.3. It is possible to run this MPM on FreeBSD 5.2.1, if you use libkse (see man libmap.conf).

For NetBSD, use at least 2.0.

For Linux, you should use a 2.6 kernel, and make sure your glibc has epoll support compiled in.

Definition at line 58 of file event.c.

◆ close_socket_nonblocking

#define close_socket_nonblocking (   csd)     close_socket_nonblocking_(csd, __FUNCTION__, __LINE__)

Definition at line 558 of file event.c.

◆ DEFAULT_SERVER_LIMIT

#define DEFAULT_SERVER_LIMIT   16

Definition at line 115 of file event.c.

◆ DEFAULT_THREAD_LIMIT

#define DEFAULT_THREAD_LIMIT   64

Definition at line 133 of file event.c.

◆ DEFAULT_WORKER_FACTOR

#define DEFAULT_WORKER_FACTOR   2

Definition at line 159 of file event.c.

◆ EVENT_FUDGE_FACTOR

#define EVENT_FUDGE_FACTOR   apr_time_from_msec(10)

Definition at line 1399 of file event.c.

◆ ID_FROM_CHILD_THREAD

#define ID_FROM_CHILD_THREAD (   c,
  t 
)    ((c * thread_limit) + t)

Definition at line 420 of file event.c.

◆ LINGERING_BUF_SIZE

#define LINGERING_BUF_SIZE   (32 * 1024)

Definition at line 1480 of file event.c.

◆ LISTENER_SIGNAL

#define LISTENER_SIGNAL   SIGHUP

Definition at line 458 of file event.c.

◆ MAX_SECS_TO_LINGER

#define MAX_SECS_TO_LINGER   30

Definition at line 150 of file event.c.

◆ MAX_SERVER_LIMIT

#define MAX_SERVER_LIMIT   20000

Definition at line 122 of file event.c.

◆ MAX_SPAWN_RATE

#define MAX_SPAWN_RATE   (32)

Definition at line 402 of file event.c.

◆ MAX_THREAD_LIMIT

#define MAX_THREAD_LIMIT   100000

Definition at line 140 of file event.c.

◆ MPM_CHILD_PID

#define MPM_CHILD_PID (   i)    (ap_scoreboard_image->parent[i].pid)

Definition at line 143 of file event.c.

◆ NON_WAKEABLE_POLL_TIMEOUT

#define NON_WAKEABLE_POLL_TIMEOUT   apr_time_from_msec(100)

◆ SECONDS_TO_LINGER

#define SECONDS_TO_LINGER   2

Definition at line 152 of file event.c.

◆ ST_GRACEFUL

#define ST_GRACEFUL   1

Definition at line 612 of file event.c.

◆ ST_INIT

#define ST_INIT   0

Definition at line 611 of file event.c.

◆ ST_UNGRACEFUL

#define ST_UNGRACEFUL   2

Definition at line 613 of file event.c.

◆ TIMEOUT_FUDGE_FACTOR

#define TIMEOUT_FUDGE_FACTOR   apr_time_from_msec(100)

Definition at line 280 of file event.c.

◆ TO_QUEUE_ELEM_INIT

#define TO_QUEUE_ELEM_INIT (   el)     APR_RING_ELEM_INIT((el), timeout_list)

Definition at line 331 of file event.c.

◆ WORKER_FACTOR_SCALE

#define WORKER_FACTOR_SCALE   16 /* scale factor to allow fractional values */

Definition at line 161 of file event.c.

Typedef Documentation

◆ event_child_bucket

◆ event_conn_state_t

Definition at line 213 of file event.c.

◆ event_retained_data

◆ event_srv_cfg

Definition at line 198 of file event.c.

Enumeration Type Documentation

◆ poll_type_e

Enumerator
PT_CSD 
PT_ACCEPT 

Definition at line 352 of file event.c.

Function Documentation

◆ check_infinite_requests()

static void check_infinite_requests ( void  )
static

Definition at line 1246 of file event.c.

◆ check_signal()

static int check_signal ( int  signum)
static

Definition at line 2212 of file event.c.

◆ child_main()

static void child_main ( int  child_num_arg,
int  child_bucket 
)
static

Definition at line 2546 of file event.c.

◆ clean_child_exit()

static void clean_child_exit ( int  code)
static

Definition at line 756 of file event.c.

◆ close_connection()

static void close_connection ( event_conn_state_t cs)
static

Definition at line 870 of file event.c.

◆ close_listeners()

static int close_listeners ( int closed)
static

Definition at line 1259 of file event.c.

◆ close_socket_nonblocking_()

static void close_socket_nonblocking_ ( apr_socket_t csd,
const char from,
int  line 
)
static

Definition at line 536 of file event.c.

◆ close_worker_sockets()

static void close_worker_sockets ( void  )
static

Definition at line 561 of file event.c.

◆ connections_above_limit()

static APR_INLINE int connections_above_limit ( int busy)
static

Definition at line 511 of file event.c.

◆ create_listener_thread()

static void create_listener_thread ( thread_starter ts)
static

Definition at line 2222 of file event.c.

◆ decrement_connection_count()

static apr_status_t decrement_connection_count ( void *  cs_)
static

Definition at line 785 of file event.c.

◆ defer_lingering_close()

static int defer_lingering_close ( event_conn_state_t cs)
static

Definition at line 840 of file event.c.

◆ disable_listensocks()

static void disable_listensocks ( void  )
static

Definition at line 467 of file event.c.

◆ dummy_signal_handler()

static void dummy_signal_handler ( int  sig)
static

Definition at line 1300 of file event.c.

◆ enable_listensocks()

static void enable_listensocks ( void  )
static

Definition at line 481 of file event.c.

◆ event_check_config()

static int event_check_config ( apr_pool_t p,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s 
)
static

< Module has handled this stage.

Definition at line 3690 of file event.c.

◆ event_get_name()

static const char * event_get_name ( void  )
static

Definition at line 749 of file event.c.

◆ event_hooks()

static void event_hooks ( apr_pool_t p)
static

Definition at line 3905 of file event.c.

◆ event_note_child_started()

static void event_note_child_started ( int  slot,
pid_t  pid 
)
static

Definition at line 731 of file event.c.

◆ event_note_child_stopped()

static void event_note_child_stopped ( int  slot,
pid_t  pid,
ap_generation_t  gen 
)
static

Definition at line 699 of file event.c.

◆ event_open_logs()

static int event_open_logs ( apr_pool_t p,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s 
)
static

< Module has handled this stage.

< Module has handled this stage.

< Module has handled this stage.

< Module has handled this stage.

Definition at line 3442 of file event.c.

◆ event_post_config()

static int event_post_config ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s 
)
static

< Module has handled this stage.

< Module has handled this stage.

Definition at line 3627 of file event.c.

◆ event_post_read_request()

static int event_post_read_request ( request_rec r)
static

< Module has handled this stage.

Definition at line 942 of file event.c.

◆ event_pre_config()

static int event_pre_config ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp 
)
static

< Adding or removing a descriptor is * thread-safe

< Descriptors passed to apr_pollset_add() * are not copied

< Do not detach

< Detach

< Module has handled this stage.

Definition at line 3529 of file event.c.

◆ event_pre_connection()

static int event_pre_connection ( conn_rec c,
void *  csd 
)
static

< Module has handled this stage.

Definition at line 3413 of file event.c.

◆ event_pre_read_request()

static void event_pre_read_request ( request_rec r,
conn_rec c 
)
static

Definition at line 926 of file event.c.

◆ event_protocol_switch()

static int event_protocol_switch ( conn_rec c,
request_rec r,
server_rec s,
const char protocol 
)
static

< Module declines to handle

Definition at line 3421 of file event.c.

◆ event_query()

static int event_query ( int  query_code,
int result,
apr_status_t rv 
)
static

< This value specifies that * an MPM is using a static * number of threads or daemons

< This value specifies that * an MPM is using a dynamic * number of threads or daemons

< Module has handled this stage.

Definition at line 643 of file event.c.

◆ event_register_timed_callback()

static apr_status_t event_register_timed_callback ( apr_time_t  t,
ap_mpm_callback_fn_t cbfn,
void *  baton 
)
static

Definition at line 1424 of file event.c.

◆ event_request_cleanup()

static apr_status_t event_request_cleanup ( void *  dummy)
static

Definition at line 916 of file event.c.

◆ event_run()

static int event_run ( apr_pool_t _pconf,
apr_pool_t plog,
server_rec s 
)
static

< Module has handled this stage.

< Module has handled this stage.

< Module has served the response completely * - it's safe to die() with no more output

< Module has served the response completely * - it's safe to die() with no more output

< Module has served the response completely * - it's safe to die() with no more output

< Module has handled this stage.

Definition at line 3186 of file event.c.

◆ get_worker()

static void get_worker ( int have_idle_worker_p,
int  blocking,
int all_busy 
)
static

Definition at line 1359 of file event.c.

◆ join_start_thread()

static void join_start_thread ( apr_thread_t start_thread_id)
static

Definition at line 2531 of file event.c.

◆ join_workers()

static void join_workers ( apr_thread_t listener,
apr_thread_t **  threads 
)
static

Definition at line 2479 of file event.c.

◆ just_die()

static void just_die ( int  sig)
static

Definition at line 774 of file event.c.

◆ listener_thread()

static void *APR_THREAD_FUNC listener_thread ( apr_thread_t thd,
void *  dummy 
)
static

Definition at line 1651 of file event.c.

◆ listeners_disabled()

static APR_INLINE apr_uint32_t listeners_disabled ( void  )
static

Definition at line 506 of file event.c.

◆ make_child()

static int make_child ( server_rec s,
int  slot,
int  bucket 
)
static

Definition at line 2740 of file event.c.

◆ notify_resume()

static void notify_resume ( event_conn_state_t cs,
int  cleanup 
)
static

Definition at line 827 of file event.c.

◆ notify_suspend()

static void notify_suspend ( event_conn_state_t cs)
static

Definition at line 820 of file event.c.

◆ perform_idle_server_maintenance()

static void perform_idle_server_maintenance ( int  child_bucket,
int max_daemon_used 
)
static

Definition at line 2833 of file event.c.

◆ process_keepalive_queue()

static void process_keepalive_queue ( apr_time_t  expiry)
static

Definition at line 1638 of file event.c.

◆ process_lingering_close()

static void process_lingering_close ( event_conn_state_t cs)
static

< Set on non-blocking sockets * (timeout != 0) on which the * previous read() did not fill a buffer * completely. the next apr_socket_recv() * will first call select()/poll() rather than * going straight into read(). (Can also * be set by an application to force a * select()/poll() call before the next * read, in cases where the app expects * that an immediate read would fail.)

Definition at line 1481 of file event.c.

◆ process_socket()

static void process_socket ( apr_thread_t thd,
apr_pool_t p,
apr_socket_t sock,
event_conn_state_t cs,
int  my_child_num,
int  my_thread_num 
)
static

< Module has handled this stage.

< Module has handled this stage.

< Module has served the response completely * - it's safe to die() with no more output

XXX If the platform does not have a usable way of bundling accept() with a socket readability check, like Win32, and there are measurable delays before the socket is readable due to the first data packet arriving, it might be better to create the cs on the listener thread with the state set to CONN_STATE_CHECK_REQUEST_LINE_READABLE

FreeBSD users will want to enable the HTTP accept filter module in their kernel for the highest performance When the accept filter is active, sockets are kept in the kernel until a HTTP request is received.

< Module has handled this stage.

< Module has served the response completely * - it's safe to die() with no more output

< Module has handled this stage.

< Module has handled this stage.

Definition at line 990 of file event.c.

◆ process_timeout_queue()

static void process_timeout_queue ( struct timeout_queue q,
apr_time_t  expiry,
int(*)(event_conn_state_t *)  func 
)
static

Definition at line 1559 of file event.c.

◆ ptrans_pre_cleanup()

static apr_status_t ptrans_pre_cleanup ( void *  dummy)
static

Definition at line 902 of file event.c.

◆ push2worker()

static apr_status_t push2worker ( event_conn_state_t cs,
apr_socket_t csd,
apr_pool_t ptrans 
)
static

Definition at line 1317 of file event.c.

◆ push_timer2worker()

static apr_status_t push_timer2worker ( timer_event_t te)
static

Definition at line 1308 of file event.c.

◆ server_main_loop()

static void server_main_loop ( int  remaining_children_to_start)
static

Definition at line 3058 of file event.c.

◆ set_daemons_to_start()

static const char * set_daemons_to_start ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 3933 of file event.c.

◆ set_max_spare_threads()

static const char * set_max_spare_threads ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 3957 of file event.c.

◆ set_max_workers()

static const char * set_max_workers ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 3969 of file event.c.

◆ set_min_spare_threads()

static const char * set_min_spare_threads ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 3945 of file event.c.

◆ set_server_limit()

static const char * set_server_limit ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 3996 of file event.c.

◆ set_thread_limit()

static const char * set_thread_limit ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 4007 of file event.c.

◆ set_threads_per_child()

static const char * set_threads_per_child ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 3985 of file event.c.

◆ set_worker_factor()

static const char * set_worker_factor ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

< Forbidden in <VirtualHost>

< Forbidden in <Limit>

< Forbidden in <Directory>

< Forbidden in <Location>

< Forbidden in <Files> or <If>

< Forbidden in <Proxy>

Definition at line 4019 of file event.c.

◆ setup_slave_conn()

static void setup_slave_conn ( conn_rec c,
void *  csd 
)
static

Definition at line 3390 of file event.c.

◆ setup_threads_runtime()

static void setup_threads_runtime ( void  )
static

< Adding or removing a descriptor is * thread-safe

< Descriptors passed to apr_pollset_add() * are not copied

< Poll operations are interruptable by * apr_pollset_wakeup() or apr_pollcb_wakeup()

< Do not try to use the default method if * the specified non-default method cannot be * used

< Do not try to use the default method if * the specified non-default method cannot be * used

< Poll operations are interruptable by * apr_pollset_wakeup() or apr_pollcb_wakeup()

< Can read without blocking

< Hangup occurred

< Pending error

< Non-blocking IO

Definition at line 2243 of file event.c.

◆ should_enable_listensocks()

static APR_INLINE int should_enable_listensocks ( void  )
static

Definition at line 531 of file event.c.

◆ shutdown_connection()

static int shutdown_connection ( event_conn_state_t cs)
static

Definition at line 885 of file event.c.

◆ signal_threads()

static void signal_threads ( int  mode)
static

Definition at line 617 of file event.c.

◆ start_threads()

static void *APR_THREAD_FUNC start_threads ( apr_thread_t thd,
void *  dummy 
)
static

Definition at line 2389 of file event.c.

◆ startup_children()

static void startup_children ( int  number_to_start)
static

Definition at line 2818 of file event.c.

◆ timer_comp()

static int timer_comp ( void *  a,
void *  b 
)
static

Definition at line 1413 of file event.c.

◆ TO_QUEUE_APPEND()

static void TO_QUEUE_APPEND ( struct timeout_queue q,
event_conn_state_t el 
)
static

Definition at line 286 of file event.c.

◆ TO_QUEUE_MAKE()

static struct timeout_queue * TO_QUEUE_MAKE ( apr_pool_t p,
apr_time_t  t,
struct timeout_queue ref 
)
static

Definition at line 318 of file event.c.

◆ TO_QUEUE_REMOVE()

static void TO_QUEUE_REMOVE ( struct timeout_queue q,
event_conn_state_t el 
)
static

Definition at line 310 of file event.c.

◆ unblock_signal()

static void unblock_signal ( int  sig)
static

Definition at line 1287 of file event.c.

◆ update_reqevents_from_sense()

static void update_reqevents_from_sense ( event_conn_state_t cs,
int  sense 
)
static

< Can read without blocking

< Hangup occurred

< Can write without blocking

< Pending error

Definition at line 966 of file event.c.

◆ wakeup_listener()

static void wakeup_listener ( void  )
static

Definition at line 573 of file event.c.

◆ worker_thread()

static void *APR_THREAD_FUNC worker_thread ( apr_thread_t thd,
void *  dummy 
)
static

Definition at line 2084 of file event.c.

◆ worker_thread_should_exit_early()

static int worker_thread_should_exit_early ( void  )
static

Definition at line 2055 of file event.c.

Variable Documentation

◆ active_daemons_limit

int active_daemons_limit = 0
static

Definition at line 169 of file event.c.

◆ all_buckets

event_child_bucket* all_buckets
static

Definition at line 412 of file event.c.

◆ ap_child_slot

int ap_child_slot
static

Definition at line 450 of file event.c.

◆ ap_daemons_to_start

int ap_daemons_to_start = 0
static

Definition at line 166 of file event.c.

◆ ap_my_pid

pid_t ap_my_pid
static

Definition at line 445 of file event.c.

◆ aplog_module_index

int* const aplog_module_index = &( mpm_event_module.module_index)
static

Definition at line 4070 of file event.c.

◆ child_fatal

int child_fatal
static

Definition at line 783 of file event.c.

◆ clogged_count

apr_uint32_t clogged_count = 0
static

Definition at line 185 of file event.c.

◆ connection_count

apr_uint32_t connection_count = 0
static

Definition at line 182 of file event.c.

◆ conns_this_child

apr_int32_t conns_this_child
static

Definition at line 180 of file event.c.

◆ defer_linger_chain

event_conn_state_t* volatile defer_linger_chain
static

Definition at line 219 of file event.c.

◆ dying

volatile int dying = 0
static

Definition at line 174 of file event.c.

◆ event_cmds

const command_rec event_cmds[]
static
Initial value:
= {
{ "ListenBacklog" , ap_set_listenbacklog , NULL , 128 , TAKE1, "Maximum length of the queue of pending connections, as used by listen(2)" }, { "ListenCoresBucketsRatio" , ap_set_listencbratio , NULL , 128 , TAKE1, "Ratio between the number of CPU cores (online) and the number of listeners buckets" }, { "Listen" , ap_set_listener , NULL , 128 , TAKE_ARGV, "A port number or a numeric IP address and a port number, and an optional protocol" }, { "SendBufferSize" , ap_set_send_buffer_size , NULL , 128 , TAKE1, "Send buffer size in bytes" }, { "ReceiveBufferSize" , ap_set_receive_buffer_size , NULL , 128 , TAKE1, "Receive buffer size in bytes" } ,
{ "StartServers" , set_daemons_to_start , NULL , 128 , TAKE1, "Number of child processes launched at server startup" },
{ "ServerLimit" , set_server_limit , NULL , 128 , TAKE1, "Maximum number of child processes for this run of Apache" },
{ "MinSpareThreads" , set_min_spare_threads , NULL , 128 , TAKE1, "Minimum number of idle threads, to handle request spikes" },
{ "MaxSpareThreads" , set_max_spare_threads , NULL , 128 , TAKE1, "Maximum number of idle threads" },
{ "MaxClients" , set_max_workers , NULL , 128 , TAKE1, "Deprecated name of MaxRequestWorkers" },
{ "MaxRequestWorkers" , set_max_workers , NULL , 128 , TAKE1, "Maximum number of threads alive at the same time" },
{ "ThreadsPerChild" , set_threads_per_child , NULL , 128 , TAKE1, "Number of threads each child creates" },
{ "ThreadLimit" , set_thread_limit , NULL , 128 , TAKE1, "Maximum number of worker threads per child process for this " "run of Apache - Upper limit for ThreadsPerChild" },
{ "AsyncRequestWorkerFactor" , set_worker_factor , NULL , 128 , TAKE1, "How many additional connects will be accepted per idle " "worker thread" },
{ "GracefulShutdownTimeout" , ap_mpm_set_graceful_shutdown , NULL , 128 , TAKE1, "Maximum time in seconds to wait for child " "processes to complete transactions during shutdown" } ,
{NULL}
}
static const char * set_max_workers(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:3969
static const char * set_server_limit(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:3996
static const char * set_min_spare_threads(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:3945
static const char * set_thread_limit(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:4007
static const char * set_max_spare_threads(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:3957
static const char * set_worker_factor(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:4019
static const char * set_threads_per_child(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:3985
static const char * set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg)
Definition event.c:3933
@ TAKE1
Definition http_config.h:51
@ TAKE_ARGV
Definition http_config.h:66
const char * ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg)
Definition listen.c:901
const char * ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, const char *arg)
Definition listen.c:941
const char * ap_set_listencbratio(cmd_parms *cmd, void *dummy, const char *arg)
Definition listen.c:921
const char * ap_set_listener(cmd_parms *cmd, void *dummy, int argc, char *const argv[])
Definition listen.c:847
const char * ap_set_receive_buffer_size(cmd_parms *cmd, void *dummy, const char *arg)
Definition listen.c:960
const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy, const char *arg)
Definition mpm_common.c:369
return NULL
Definition mod_so.c:359

Definition at line 4044 of file event.c.

◆ event_pollset

apr_pollset_t* event_pollset
static

Definition at line 211 of file event.c.

◆ g_timer_skiplist_mtx

apr_thread_mutex_t* g_timer_skiplist_mtx
static

Definition at line 1422 of file event.c.

◆ had_healthy_child

int had_healthy_child = 0
static

Definition at line 173 of file event.c.

◆ keepalive_q

struct timeout_queue * keepalive_q
static

Definition at line 271 of file event.c.

◆ linger_q

struct timeout_queue * linger_q
static

Definition at line 272 of file event.c.

◆ lingering_count

apr_uint32_t lingering_count = 0
static

Definition at line 183 of file event.c.

◆ listener_is_wakeable

int listener_is_wakeable = 0
static

Definition at line 178 of file event.c.

◆ listener_may_exit

volatile int listener_may_exit = 0
static

Definition at line 177 of file event.c.

◆ listener_os_thread

apr_os_thread_t* listener_os_thread
static

Definition at line 448 of file event.c.

◆ listener_pollfd

apr_pollfd_t* listener_pollfd
static

Definition at line 200 of file event.c.

◆ listensocks_disabled

volatile apr_uint32_t listensocks_disabled
static

Definition at line 465 of file event.c.

◆ max_spare_threads

int max_spare_threads = 0
static

Definition at line 168 of file event.c.

◆ max_workers

int max_workers = 0
static

Definition at line 170 of file event.c.

◆ min_spare_threads

int min_spare_threads = 0
static

Definition at line 167 of file event.c.

◆ my_bucket

event_child_bucket * my_bucket
static

Definition at line 413 of file event.c.

◆ num_listensocks

int num_listensocks = 0
static

Definition at line 179 of file event.c.

◆ one_process

int one_process = 0
static

Definition at line 435 of file event.c.

◆ parent_pid

pid_t parent_pid
static

Definition at line 447 of file event.c.

◆ pchild

apr_pool_t* pchild
static

Definition at line 442 of file event.c.

◆ pconf

apr_pool_t* pconf
static

Definition at line 441 of file event.c.

◆ pruntime

apr_pool_t* pruntime
static

Definition at line 443 of file event.c.

◆ queues_next_expiry

volatile apr_time_t queues_next_expiry
static

Definition at line 274 of file event.c.

◆ resource_shortage

int resource_shortage = 0
static

Definition at line 188 of file event.c.

◆ retained

event_retained_data* retained
static

Definition at line 406 of file event.c.

◆ server_limit

int server_limit = 0
static

Definition at line 171 of file event.c.

◆ short_linger_q

struct timeout_queue * short_linger_q
static

Definition at line 273 of file event.c.

◆ start_thread_may_exit

volatile int start_thread_may_exit = 0
static

Definition at line 176 of file event.c.

◆ suspended_count

apr_uint32_t suspended_count = 0
static

Definition at line 184 of file event.c.

◆ terminate_mode

int terminate_mode = 0
static

Definition at line 615 of file event.c.

◆ thread_limit

int thread_limit = 0
static

Definition at line 172 of file event.c.

◆ threads_per_child

int threads_per_child = 0
static

Definition at line 165 of file event.c.

◆ threads_shutdown

apr_uint32_t threads_shutdown = 0
static

Definition at line 186 of file event.c.

◆ timeout_mutex

apr_thread_mutex_t* timeout_mutex
static

Definition at line 192 of file event.c.

◆ timer_free_ring

timer_event_t timer_free_ring
static

Definition at line 1390 of file event.c.

◆ timer_skiplist

apr_skiplist* timer_skiplist
static

Definition at line 1392 of file event.c.

◆ timers_next_expiry

volatile apr_time_t timers_next_expiry
static

Definition at line 1393 of file event.c.

◆ worker_factor

unsigned int worker_factor = 2 * 16
static

Definition at line 162 of file event.c.

◆ worker_queue

fd_queue_t* worker_queue
static

Definition at line 189 of file event.c.

◆ worker_queue_info

fd_queue_info_t* worker_queue_info
static

Definition at line 190 of file event.c.

◆ worker_sockets

apr_socket_t** worker_sockets
static

Definition at line 463 of file event.c.

◆ workers_may_exit

volatile int workers_may_exit = 0
static

Definition at line 175 of file event.c.

◆ write_completion_q

struct timeout_queue* write_completion_q
static

Definition at line 270 of file event.c.