nginx/src/event/ngx_event.h

573 lines
13 KiB
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
#ifndef _NGX_EVENT_H_INCLUDED_
#define _NGX_EVENT_H_INCLUDED_
#include <ngx_config.h>
2003-05-20 23:37:55 +08:00
#include <ngx_core.h>
2003-11-21 14:30:49 +08:00
#define NGX_INVALID_INDEX 0xd0d0d0d0
2002-12-15 14:25:09 +08:00
2003-05-20 00:39:14 +08:00
#if (NGX_HAVE_IOCP)
2003-06-06 22:59:20 +08:00
2003-02-07 01:21:13 +08:00
typedef struct {
WSAOVERLAPPED ovlp;
ngx_event_t *event;
int error;
} ngx_event_ovlp_t;
2003-06-06 22:59:20 +08:00
2003-02-07 01:21:13 +08:00
#endif
2004-03-01 05:03:02 +08:00
typedef struct {
ngx_uint_t lock;
ngx_event_t *events;
ngx_event_t *last;
} ngx_event_mutex_t;
struct ngx_event_s {
void *data;
2004-03-03 05:14:37 +08:00
2004-07-02 23:54:34 +08:00
unsigned write:1;
2004-07-02 23:54:34 +08:00
unsigned accept:1;
2007-09-01 17:33:25 +08:00
/* used to detect the stale events in kqueue, rtsig, and epoll */
2004-07-02 23:54:34 +08:00
unsigned instance:1;
2003-05-12 23:52:24 +08:00
2003-10-13 00:49:16 +08:00
/*
2003-10-29 16:30:44 +08:00
* the event was passed or would be passed to a kernel;
2003-10-30 16:51:06 +08:00
* in aio mode - operation was posted.
2003-10-13 00:49:16 +08:00
*/
2004-07-02 23:54:34 +08:00
unsigned active:1;
2003-10-13 00:49:16 +08:00
2004-07-02 23:54:34 +08:00
unsigned disabled:1;
2004-03-31 23:26:46 +08:00
2003-10-30 16:51:06 +08:00
/* the ready event; in aio mode 0 means that no operation can be posted */
2004-07-02 23:54:34 +08:00
unsigned ready:1;
2003-10-30 16:51:06 +08:00
2006-09-26 20:20:12 +08:00
unsigned oneshot:1;
2003-10-30 16:51:06 +08:00
/* aio operation is complete */
2004-07-02 23:54:34 +08:00
unsigned complete:1;
2003-10-13 00:49:16 +08:00
2004-07-02 23:54:34 +08:00
unsigned eof:1;
unsigned error:1;
2004-06-21 23:59:32 +08:00
2004-07-02 23:54:34 +08:00
unsigned timedout:1;
unsigned timer_set:1;
2004-07-02 23:54:34 +08:00
unsigned delayed:1;
2004-07-02 23:54:34 +08:00
unsigned read_discarded:1;
2004-03-31 23:26:46 +08:00
2004-07-02 23:54:34 +08:00
unsigned unexpected_eof:1;
2003-02-07 01:21:13 +08:00
2004-07-02 23:54:34 +08:00
unsigned deferred_accept:1;
2004-06-07 03:49:18 +08:00
2004-07-02 23:54:34 +08:00
/* the pending eof reported by kqueue or in aio chain operation */
unsigned pending_eof:1;
2003-10-30 16:51:06 +08:00
2004-07-07 23:01:00 +08:00
#if !(NGX_THREADS)
unsigned posted_ready:1;
#endif
#if (NGX_WIN32)
2003-10-30 16:51:06 +08:00
/* setsockopt(SO_UPDATE_ACCEPT_CONTEXT) was succesfull */
2004-07-02 23:54:34 +08:00
unsigned accept_context_updated:1;
2003-06-06 22:59:20 +08:00
#endif
#if (NGX_HAVE_KQUEUE)
2004-07-02 23:54:34 +08:00
unsigned kq_vnode:1;
2003-11-26 04:44:56 +08:00
2003-10-30 16:51:06 +08:00
/* the pending errno reported by kqueue */
2003-10-28 23:45:41 +08:00
int kq_errno;
#endif
2003-01-27 05:08:14 +08:00
2003-12-05 15:11:46 +08:00
/*
* kqueue only:
* accept: number of sockets that wait to be accepted
* read: bytes to read when event is ready
* or lowat when event is set with NGX_LOWAT_EVENT flag
* write: available space in buffer when event is ready
* or lowat when event is set with NGX_LOWAT_EVENT flag
*
2004-03-05 16:34:24 +08:00
* iocp: TODO
*
2003-12-05 15:11:46 +08:00
* otherwise:
* accept: 1 if accept many, 0 otherwise
*/
#if (NGX_HAVE_KQUEUE) || (NGX_HAVE_IOCP)
2003-12-05 15:11:46 +08:00
int available;
#else
2004-07-02 23:54:34 +08:00
unsigned available:1;
2003-12-05 15:11:46 +08:00
#endif
nginx-0.1.29-RELEASE import *) Feature: the ngx_http_ssi_module supports "include virtual" command. *) Feature: the ngx_http_ssi_module supports the condition command like 'if expr="$NAME"' and "else" and "endif" commands. Only one nested level is supported. *) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and DATE_GMT variables and "config timefmt" command. *) Feature: the "ssi_ignore_recycled_buffers" directive. *) Bugfix: the "echo" command did not show the default value for the empty QUERY_STRING variable. *) Change: the ngx_http_proxy_module was rewritten. *) Feature: the "proxy_redirect", "proxy_pass_request_headers", "proxy_pass_request_body", and "proxy_method" directives. *) Feature: the "proxy_set_header" directive. The "proxy_x_var" was canceled and must be replaced with the proxy_set_header directive. *) Change: the "proxy_preserve_host" is canceled and must be replaced with the "proxy_set_header Host $host" and the "proxy_redirect off" directives, the "proxy_set_header Host $host:$proxy_port" directive and the appropriate proxy_redirect directives. *) Change: the "proxy_set_x_real_ip" is canceled and must be replaced with the "proxy_set_header X-Real-IP $remote_addr" directive. *) Change: the "proxy_add_x_forwarded_for" is canceled and must be replaced with the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for" directive. *) Change: the "proxy_set_x_url" is canceled and must be replaced with the "proxy_set_header X-URL http://$host:$server_port$request_uri" directive. *) Feature: the "fastcgi_param" directive. *) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params" directive are canceled and must be replaced with the fastcgi_param directives. *) Feature: the "index" directive can use the variables. *) Feature: the "index" directive can be used at http and server levels. *) Change: the last index only in the "index" directive can be absolute. *) Feature: the "rewrite" directive can use the variables. *) Feature: the "internal" directive. *) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR, SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME, REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables. *) Change: nginx now passes the invalid lines in a client request headers or a backend response header. *) Bugfix: if the backend did not transfer response for a long time and the "send_timeout" was less than "proxy_read_timeout", then nginx returned the 408 response. *) Bugfix: the segmentation fault was occurred if the backend sent an invalid line in response header; the bug had appeared in 0.1.26. *) Bugfix: the segmentation fault may occurred in FastCGI fault tolerance configuration. *) Bugfix: the "expires" directive did not remove the previous "Expires" and "Cache-Control" headers. *) Bugfix: nginx did not take into account trailing dot in "Host" header line. *) Bugfix: the ngx_http_auth_module did not work under Linux. *) Bugfix: the rewrite directive worked incorrectly, if the arguments were in a request. *) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
ngx_event_handler_pt handler;
2004-07-02 23:54:34 +08:00
2003-02-07 01:21:13 +08:00
#if (NGX_HAVE_AIO)
2003-02-07 01:21:13 +08:00
#if (NGX_HAVE_IOCP)
2003-02-07 01:21:13 +08:00
ngx_event_ovlp_t ovlp;
#else
struct aiocb aiocb;
#endif
#endif
ngx_uint_t index;
2003-02-07 01:21:13 +08:00
2004-07-02 23:54:34 +08:00
ngx_log_t *log;
2004-07-02 13:47:00 +08:00
ngx_rbtree_node_t timer;
2004-07-02 23:54:34 +08:00
unsigned closed:1;
/* to test on worker exit */
unsigned channel:1;
unsigned resolver:1;
2004-07-02 23:54:34 +08:00
#if (NGX_THREADS)
2004-07-02 13:47:00 +08:00
unsigned locked:1;
unsigned posted_ready:1;
unsigned posted_timedout:1;
unsigned posted_eof:1;
#if (NGX_HAVE_KQUEUE)
2004-07-02 13:47:00 +08:00
/* the pending errno reported by kqueue */
int posted_errno;
#endif
#if (NGX_HAVE_KQUEUE) || (NGX_HAVE_IOCP)
2004-07-02 13:47:00 +08:00
int posted_available;
#else
unsigned posted_available:1;
#endif
2004-07-02 23:54:34 +08:00
ngx_atomic_t *lock;
2004-07-07 14:15:04 +08:00
ngx_atomic_t *own_lock;
2004-07-02 23:54:34 +08:00
2004-06-28 02:01:57 +08:00
#endif
2004-07-02 23:54:34 +08:00
/* the links of the posted queue */
ngx_event_t *next;
ngx_event_t **prev;
2004-06-28 02:01:57 +08:00
2003-01-27 05:08:14 +08:00
#if 0
2003-10-28 23:45:41 +08:00
/* the threads support */
/*
* the event thread context, we store it here
* if $(CC) does not understand __thread declaration
* and pthread_getspecific() is too costly
*/
void *thr_ctx;
2003-01-27 05:08:14 +08:00
#if (NGX_EVENT_T_PADDING)
2003-10-28 23:45:41 +08:00
/* event should not cross cache line in SMP */
2003-05-12 23:52:24 +08:00
uint32_t padding[NGX_EVENT_T_PADDING];
2003-02-27 04:21:43 +08:00
#endif
2003-05-20 23:37:55 +08:00
#endif
2003-10-28 23:45:41 +08:00
};
2003-05-20 00:39:14 +08:00
2009-08-28 16:12:35 +08:00
#if (NGX_HAVE_FILE_AIO)
struct ngx_event_aio_s {
void *data;
ngx_event_handler_pt handler;
ngx_file_t *file;
ngx_fd_t fd;
#if (NGX_HAVE_EVENTFD)
int64_t res;
#if (NGX_TEST_BUILD_EPOLL)
ngx_err_t err;
size_t nbytes;
#endif
#else
ngx_err_t err;
size_t nbytes;
#endif
2009-08-30 17:52:39 +08:00
#if (NGX_HAVE_AIO_SENDFILE)
off_t last_offset;
#endif
2009-08-28 16:12:35 +08:00
ngx_aiocb_t aiocb;
ngx_event_t event;
};
#endif
typedef struct {
in_addr_t mask;
in_addr_t addr;
} ngx_event_debug_t;
typedef struct {
ngx_int_t (*add)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
ngx_int_t (*del)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
2003-05-20 00:39:14 +08:00
ngx_int_t (*enable)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
ngx_int_t (*disable)(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags);
2003-05-20 00:39:14 +08:00
2004-06-16 23:32:11 +08:00
ngx_int_t (*add_conn)(ngx_connection_t *c);
ngx_int_t (*del_conn)(ngx_connection_t *c, ngx_uint_t flags);
2003-05-20 00:39:14 +08:00
ngx_int_t (*process_changes)(ngx_cycle_t *cycle, ngx_uint_t nowait);
ngx_int_t (*process_events)(ngx_cycle_t *cycle, ngx_msec_t timer,
ngx_uint_t flags);
2004-07-07 14:15:04 +08:00
ngx_int_t (*init)(ngx_cycle_t *cycle, ngx_msec_t timer);
2004-06-16 23:32:11 +08:00
void (*done)(ngx_cycle_t *cycle);
} ngx_event_actions_t;
2002-08-16 01:20:26 +08:00
2003-10-28 23:45:41 +08:00
extern ngx_event_actions_t ngx_event_actions;
2003-10-13 00:49:16 +08:00
/*
* The event filter requires to read/write the whole data:
2004-02-13 04:57:10 +08:00
* select, poll, /dev/poll, kqueue, epoll.
2003-10-13 00:49:16 +08:00
*/
2004-04-05 04:32:09 +08:00
#define NGX_USE_LEVEL_EVENT 0x00000001
2003-10-13 00:49:16 +08:00
/*
* The event filter is deleted after a notification without an additional
2006-09-26 20:20:12 +08:00
* syscall: kqueue, epoll.
2003-10-13 00:49:16 +08:00
*/
2004-04-05 04:32:09 +08:00
#define NGX_USE_ONESHOT_EVENT 0x00000002
2003-10-13 00:49:16 +08:00
/*
* The event filter notifies only the changes and an initial level:
2004-02-13 04:57:10 +08:00
* kqueue, epoll.
2003-10-13 00:49:16 +08:00
*/
2004-04-05 04:32:09 +08:00
#define NGX_USE_CLEAR_EVENT 0x00000004
2003-10-13 00:49:16 +08:00
/*
* The event filter has kqueue features: the eof flag, errno,
2004-01-28 23:22:37 +08:00
* available data, etc.
2003-10-13 00:49:16 +08:00
*/
#define NGX_USE_KQUEUE_EVENT 0x00000008
2003-10-13 00:49:16 +08:00
/*
* The event filter supports low water mark: kqueue's NOTE_LOWAT.
2003-10-13 00:49:16 +08:00
* kqueue in FreeBSD 4.1-4.2 has no NOTE_LOWAT so we need a separate flag.
*/
#define NGX_USE_LOWAT_EVENT 0x00000010
2004-04-05 04:32:09 +08:00
2004-04-28 14:14:50 +08:00
/*
2007-09-01 17:33:25 +08:00
* The event filter requires to do i/o operation until EAGAIN: epoll, rtsig.
2004-04-28 14:14:50 +08:00
*/
#define NGX_USE_GREEDY_EVENT 0x00000020
2004-04-28 14:14:50 +08:00
2003-10-13 00:49:16 +08:00
/*
* The event filter is epoll.
2003-10-13 00:49:16 +08:00
*/
2004-07-07 23:01:00 +08:00
#define NGX_USE_EPOLL_EVENT 0x00000040
2003-10-13 00:49:16 +08:00
/*
2007-09-01 17:33:25 +08:00
* No need to add or delete the event filters: rtsig.
2003-10-13 00:49:16 +08:00
*/
2004-07-07 23:01:00 +08:00
#define NGX_USE_RTSIG_EVENT 0x00000080
2003-10-13 00:49:16 +08:00
/*
* No need to add or delete the event filters: overlapped, aio_read,
2003-10-13 00:49:16 +08:00
* aioread, io_submit.
*/
2004-07-07 23:01:00 +08:00
#define NGX_USE_AIO_EVENT 0x00000100
2003-10-13 00:49:16 +08:00
/*
* Need to add socket or handle only once: i/o completion port.
* It also requires NGX_HAVE_AIO and NGX_USE_AIO_EVENT to be set.
2003-10-13 00:49:16 +08:00
*/
2004-07-07 23:01:00 +08:00
#define NGX_USE_IOCP_EVENT 0x00000200
2003-10-13 00:49:16 +08:00
/*
* The event filter has no opaque data and requires file descriptors table:
2007-09-01 17:33:25 +08:00
* poll, /dev/poll, rtsig.
*/
#define NGX_USE_FD_EVENT 0x00000400
/*
* The event module handles periodic or absolute timer event by itself:
2007-08-31 17:50:23 +08:00
* kqueue in FreeBSD 4.4, NetBSD 2.0, and MacOSX 10.4, Solaris 10's event ports.
*/
#define NGX_USE_TIMER_EVENT 0x00000800
2006-09-26 20:20:12 +08:00
/*
* All event filters on file descriptor are deleted after a notification:
* Solaris 10's event ports.
*/
2007-08-31 17:41:45 +08:00
#define NGX_USE_EVENTPORT_EVENT 0x00001000
2006-09-26 20:20:12 +08:00
/*
* The event filter support vnode notifications: kqueue.
*/
#define NGX_USE_VNODE_EVENT 0x00002000
2003-10-13 00:49:16 +08:00
/*
2007-09-01 17:33:25 +08:00
* The event filter is deleted just before the closing file.
* Has no meaning for select and poll.
* kqueue, epoll, rtsig, eventport: allows to avoid explicit delete,
* because filter automatically is deleted
* on file close,
*
* /dev/poll: we need to flush POLLREMOVE event
* before closing file.
2003-10-13 00:49:16 +08:00
*/
2003-11-19 00:49:00 +08:00
#define NGX_CLOSE_EVENT 1
2007-09-01 19:21:00 +08:00
/*
* disable temporarily event filter, this may avoid locks
* in kernel malloc()/free(): kqueue.
*/
2004-06-15 15:55:11 +08:00
#define NGX_DISABLE_EVENT 2
2003-11-19 00:49:00 +08:00
/*
* event must be passed to kernel right now, do not wait until batch processing.
*/
#define NGX_FLUSH_EVENT 4
2003-11-19 00:49:00 +08:00
2003-11-21 14:30:49 +08:00
/* these flags have a meaning only for kqueue */
2003-11-19 00:49:00 +08:00
#define NGX_LOWAT_EVENT 0
2003-11-26 04:44:56 +08:00
#define NGX_VNODE_EVENT 0
2002-12-15 14:25:09 +08:00
#if (NGX_HAVE_KQUEUE)
#define NGX_READ_EVENT EVFILT_READ
#define NGX_WRITE_EVENT EVFILT_WRITE
2003-11-26 04:44:56 +08:00
#undef NGX_VNODE_EVENT
#define NGX_VNODE_EVENT EVFILT_VNODE
2003-10-13 00:49:16 +08:00
/*
* NGX_CLOSE_EVENT, NGX_LOWAT_EVENT, and NGX_FLUSH_EVENT are the module flags
* and they must not go into a kernel so we need to choose the value
* that must not interfere with any existent and future kqueue flags.
* kqueue has such values - EV_FLAG1, EV_EOF, and EV_ERROR:
* they are reserved and cleared on a kernel entrance.
2003-10-13 00:49:16 +08:00
*/
2003-03-21 00:09:44 +08:00
#undef NGX_CLOSE_EVENT
2003-11-19 00:49:00 +08:00
#define NGX_CLOSE_EVENT EV_EOF
#undef NGX_LOWAT_EVENT
#define NGX_LOWAT_EVENT EV_FLAG1
2003-03-21 00:09:44 +08:00
#undef NGX_FLUSH_EVENT
#define NGX_FLUSH_EVENT EV_ERROR
2002-08-26 23:18:19 +08:00
#define NGX_LEVEL_EVENT 0
#define NGX_ONESHOT_EVENT EV_ONESHOT
2003-03-21 00:09:44 +08:00
#define NGX_CLEAR_EVENT EV_CLEAR
2002-09-02 22:48:24 +08:00
2003-11-21 14:30:49 +08:00
#undef NGX_DISABLE_EVENT
#define NGX_DISABLE_EVENT EV_DISABLE
2002-09-07 18:14:25 +08:00
2006-09-26 20:20:12 +08:00
#elif (NGX_HAVE_DEVPOLL || NGX_HAVE_EVENTPORT)
2002-12-23 14:29:22 +08:00
#define NGX_READ_EVENT POLLIN
#define NGX_WRITE_EVENT POLLOUT
#define NGX_LEVEL_EVENT 0
2004-02-18 23:45:21 +08:00
#define NGX_ONESHOT_EVENT 1
2002-12-23 14:29:22 +08:00
2003-10-28 23:45:41 +08:00
#elif (NGX_HAVE_EPOLL)
2004-02-13 04:57:10 +08:00
#define NGX_READ_EVENT EPOLLIN
#define NGX_WRITE_EVENT EPOLLOUT
#define NGX_LEVEL_EVENT 0
#define NGX_CLEAR_EVENT EPOLLET
#define NGX_ONESHOT_EVENT 0x70000000
#if 0
#define NGX_ONESHOT_EVENT EPOLLONESHOT
#endif
#elif (NGX_HAVE_POLL)
2003-10-28 23:45:41 +08:00
#define NGX_READ_EVENT POLLIN
#define NGX_WRITE_EVENT POLLOUT
#define NGX_LEVEL_EVENT 0
2004-02-13 04:57:10 +08:00
#define NGX_ONESHOT_EVENT 1
2003-10-28 23:45:41 +08:00
#else /* select */
#define NGX_READ_EVENT 0
#define NGX_WRITE_EVENT 1
2002-08-26 23:18:19 +08:00
#define NGX_LEVEL_EVENT 0
#define NGX_ONESHOT_EVENT 1
#endif /* NGX_HAVE_KQUEUE */
2003-10-28 23:45:41 +08:00
#if (NGX_HAVE_IOCP)
2003-10-28 23:45:41 +08:00
#define NGX_IOCP_ACCEPT 0
#define NGX_IOCP_IO 1
2003-11-17 05:49:42 +08:00
#define NGX_IOCP_CONNECT 2
2003-05-20 23:37:55 +08:00
#endif
2002-08-16 01:20:26 +08:00
2003-10-28 23:45:41 +08:00
#ifndef NGX_CLEAR_EVENT
#define NGX_CLEAR_EVENT 0 /* dummy declaration */
2003-01-24 02:47:54 +08:00
#endif
2002-08-16 01:20:26 +08:00
2004-07-07 14:15:04 +08:00
#define ngx_process_changes ngx_event_actions.process_changes
#define ngx_process_events ngx_event_actions.process_events
#define ngx_done_events ngx_event_actions.done
#define ngx_add_event ngx_event_actions.add
#define ngx_del_event ngx_event_actions.del
2003-05-29 21:02:09 +08:00
#define ngx_add_conn ngx_event_actions.add_conn
2003-05-22 23:23:47 +08:00
#define ngx_del_conn ngx_event_actions.del_conn
2003-02-07 01:21:13 +08:00
2003-10-28 23:45:41 +08:00
#define ngx_add_timer ngx_event_add_timer
#define ngx_del_timer ngx_event_del_timer
2003-06-11 23:28:34 +08:00
extern ngx_os_io_t ngx_io;
2003-06-11 23:28:34 +08:00
#define ngx_recv ngx_io.recv
2003-10-07 23:30:05 +08:00
#define ngx_recv_chain ngx_io.recv_chain
2007-12-04 00:46:46 +08:00
#define ngx_udp_recv ngx_io.udp_recv
#define ngx_send ngx_io.send
2004-07-17 01:11:43 +08:00
#define ngx_send_chain ngx_io.send_chain
2003-06-11 23:28:34 +08:00
2003-05-27 20:18:54 +08:00
#define NGX_EVENT_MODULE 0x544E5645 /* "EVNT" */
#define NGX_EVENT_CONF 0x02000000
2003-05-20 00:39:14 +08:00
typedef struct {
2004-04-22 02:54:33 +08:00
ngx_uint_t connections;
2004-06-16 23:32:11 +08:00
ngx_uint_t use;
2004-04-02 00:20:53 +08:00
2004-04-08 23:58:25 +08:00
ngx_flag_t multi_accept;
ngx_flag_t accept_mutex;
2004-04-02 00:20:53 +08:00
2004-04-08 23:58:25 +08:00
ngx_msec_t accept_mutex_delay;
2004-04-05 04:32:09 +08:00
2004-04-08 23:58:25 +08:00
u_char *name;
#if (NGX_DEBUG)
ngx_array_t debug_connection;
#endif
2003-05-20 00:39:14 +08:00
} ngx_event_conf_t;
typedef struct {
ngx_str_t *name;
2003-07-07 14:11:50 +08:00
void *(*create_conf)(ngx_cycle_t *cycle);
char *(*init_conf)(ngx_cycle_t *cycle, void *conf);
2003-05-20 00:39:14 +08:00
ngx_event_actions_t actions;
} ngx_event_module_t;
2004-04-10 00:03:04 +08:00
extern ngx_atomic_t *ngx_connection_counter;
2003-10-28 23:45:41 +08:00
2004-04-01 14:21:13 +08:00
extern ngx_atomic_t *ngx_accept_mutex_ptr;
extern ngx_shmtx_t ngx_accept_mutex;
extern ngx_uint_t ngx_use_accept_mutex;
2006-09-26 20:20:12 +08:00
extern ngx_uint_t ngx_accept_events;
2004-04-01 14:21:13 +08:00
extern ngx_uint_t ngx_accept_mutex_held;
2004-04-05 04:32:09 +08:00
extern ngx_msec_t ngx_accept_mutex_delay;
2004-04-22 02:54:33 +08:00
extern ngx_int_t ngx_accept_disabled;
2004-04-05 04:32:09 +08:00
2004-04-01 14:21:13 +08:00
#if (NGX_STAT_STUB)
extern ngx_atomic_t *ngx_stat_accepted;
extern ngx_atomic_t *ngx_stat_handled;
extern ngx_atomic_t *ngx_stat_requests;
extern ngx_atomic_t *ngx_stat_active;
extern ngx_atomic_t *ngx_stat_reading;
extern ngx_atomic_t *ngx_stat_writing;
#endif
#define NGX_UPDATE_TIME 1
#define NGX_POST_EVENTS 2
#define NGX_POST_THREAD_EVENTS 4
2004-03-31 23:26:46 +08:00
2004-02-27 01:10:01 +08:00
extern sig_atomic_t ngx_event_timer_alarm;
2004-04-02 00:20:53 +08:00
extern ngx_uint_t ngx_event_flags;
2004-03-01 05:03:02 +08:00
extern ngx_module_t ngx_events_module;
extern ngx_module_t ngx_event_core_module;
2003-05-20 00:39:14 +08:00
2003-07-04 23:10:33 +08:00
#define ngx_event_get_conf(conf_ctx, module) \
(*(ngx_get_conf(conf_ctx, ngx_events_module))) [module.ctx_index];
2003-05-16 23:27:48 +08:00
2003-05-14 00:02:32 +08:00
void ngx_event_accept(ngx_event_t *ev);
2004-03-31 23:26:46 +08:00
ngx_int_t ngx_trylock_accept_mutex(ngx_cycle_t *cycle);
u_char *ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len);
2004-03-31 23:26:46 +08:00
2003-05-14 00:02:32 +08:00
void ngx_process_events_and_timers(ngx_cycle_t *cycle);
ngx_int_t ngx_handle_read_event(ngx_event_t *rev, ngx_uint_t flags);
nginx-0.1.29-RELEASE import *) Feature: the ngx_http_ssi_module supports "include virtual" command. *) Feature: the ngx_http_ssi_module supports the condition command like 'if expr="$NAME"' and "else" and "endif" commands. Only one nested level is supported. *) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and DATE_GMT variables and "config timefmt" command. *) Feature: the "ssi_ignore_recycled_buffers" directive. *) Bugfix: the "echo" command did not show the default value for the empty QUERY_STRING variable. *) Change: the ngx_http_proxy_module was rewritten. *) Feature: the "proxy_redirect", "proxy_pass_request_headers", "proxy_pass_request_body", and "proxy_method" directives. *) Feature: the "proxy_set_header" directive. The "proxy_x_var" was canceled and must be replaced with the proxy_set_header directive. *) Change: the "proxy_preserve_host" is canceled and must be replaced with the "proxy_set_header Host $host" and the "proxy_redirect off" directives, the "proxy_set_header Host $host:$proxy_port" directive and the appropriate proxy_redirect directives. *) Change: the "proxy_set_x_real_ip" is canceled and must be replaced with the "proxy_set_header X-Real-IP $remote_addr" directive. *) Change: the "proxy_add_x_forwarded_for" is canceled and must be replaced with the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for" directive. *) Change: the "proxy_set_x_url" is canceled and must be replaced with the "proxy_set_header X-URL http://$host:$server_port$request_uri" directive. *) Feature: the "fastcgi_param" directive. *) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params" directive are canceled and must be replaced with the fastcgi_param directives. *) Feature: the "index" directive can use the variables. *) Feature: the "index" directive can be used at http and server levels. *) Change: the last index only in the "index" directive can be absolute. *) Feature: the "rewrite" directive can use the variables. *) Feature: the "internal" directive. *) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR, SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME, REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables. *) Change: nginx now passes the invalid lines in a client request headers or a backend response header. *) Bugfix: if the backend did not transfer response for a long time and the "send_timeout" was less than "proxy_read_timeout", then nginx returned the 408 response. *) Bugfix: the segmentation fault was occurred if the backend sent an invalid line in response header; the bug had appeared in 0.1.26. *) Bugfix: the segmentation fault may occurred in FastCGI fault tolerance configuration. *) Bugfix: the "expires" directive did not remove the previous "Expires" and "Cache-Control" headers. *) Bugfix: nginx did not take into account trailing dot in "Host" header line. *) Bugfix: the ngx_http_auth_module did not work under Linux. *) Bugfix: the rewrite directive worked incorrectly, if the arguments were in a request. *) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
ngx_int_t ngx_handle_write_event(ngx_event_t *wev, size_t lowat);
#if (NGX_WIN32)
2003-06-11 23:28:34 +08:00
void ngx_event_acceptex(ngx_event_t *ev);
ngx_int_t ngx_event_post_acceptex(ngx_listening_t *ls, ngx_uint_t n);
u_char *ngx_acceptex_log_error(ngx_log_t *log, u_char *buf, size_t len);
2003-06-11 23:28:34 +08:00
#endif
ngx_int_t ngx_send_lowat(ngx_connection_t *c, size_t lowat);
2004-01-06 04:55:48 +08:00
/* used in ngx_log_debugX() */
#define ngx_event_ident(p) ((ngx_connection_t *) (p))->fd
2003-06-11 23:28:34 +08:00
2003-05-20 00:39:14 +08:00
#include <ngx_event_timer.h>
2004-04-05 04:32:09 +08:00
#include <ngx_event_posted.h>
2004-03-03 05:14:37 +08:00
#include <ngx_event_busy_lock.h>
2003-10-28 23:45:41 +08:00
#if (NGX_WIN32)
2003-06-11 23:28:34 +08:00
#include <ngx_iocp_module.h>
#endif
2003-10-10 23:10:50 +08:00
#endif /* _NGX_EVENT_H_INCLUDED_ */