Mercurial > hg > nginx
comparison src/event/ngx_event.h @ 92:19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 20 May 2003 15:37:55 +0000 |
parents | 637625a2acdb |
children | 738fe44c70d5 |
comparison
equal
deleted
inserted
replaced
91:637625a2acdb | 92:19cc647ecd91 |
---|---|
1 #ifndef _NGX_EVENT_H_INCLUDED_ | 1 #ifndef _NGX_EVENT_H_INCLUDED_ |
2 #define _NGX_EVENT_H_INCLUDED_ | 2 #define _NGX_EVENT_H_INCLUDED_ |
3 | 3 |
4 | 4 |
5 #include <ngx_config.h> | 5 #include <ngx_config.h> |
6 #include <ngx_core.h> | |
7 | |
8 #if 0 | |
6 #include <ngx_types.h> | 9 #include <ngx_types.h> |
7 #include <ngx_time.h> | 10 #include <ngx_time.h> |
8 #include <ngx_socket.h> | 11 #include <ngx_socket.h> |
9 #include <ngx_log.h> | 12 #include <ngx_log.h> |
10 #include <ngx_alloc.h> | 13 #include <ngx_alloc.h> |
11 #include <ngx_array.h> | 14 #include <ngx_array.h> |
12 #include <ngx_conf_file.h> | 15 #include <ngx_conf_file.h> |
16 #endif | |
13 | 17 |
14 | 18 |
15 | 19 |
16 /* STUB */ | 20 /* STUB */ |
17 #define NGX_LOWAT 10000 | 21 #define NGX_LOWAT 10000 |
18 | 22 |
19 #define NGX_INVALID_INDEX 0x80000000 | 23 #define NGX_INVALID_INDEX 0x80000000 |
20 | 24 |
21 | 25 |
26 #if 0 | |
22 typedef struct ngx_event_s ngx_event_t; | 27 typedef struct ngx_event_s ngx_event_t; |
28 #endif | |
23 | 29 |
24 #if (HAVE_IOCP) | 30 #if (HAVE_IOCP) |
25 typedef struct { | 31 typedef struct { |
26 WSAOVERLAPPED ovlp; | 32 WSAOVERLAPPED ovlp; |
27 ngx_event_t *event; | 33 ngx_event_t *event; |
123 #endif | 129 #endif |
124 #endif | 130 #endif |
125 }; | 131 }; |
126 | 132 |
127 | 133 |
134 #if 1 | |
128 typedef enum { | 135 typedef enum { |
129 NGX_SELECT_EVENT_N = 0, | 136 NGX_SELECT_EVENT_N = 0, |
130 #if (HAVE_POLL) | 137 #if (HAVE_POLL) |
131 NGX_POLL_EVENT_N, | 138 NGX_POLL_EVENT_N, |
132 #endif | 139 #endif |
142 #if (HAVE_IOCP) | 149 #if (HAVE_IOCP) |
143 NGX_IOCP_EVENT_N, | 150 NGX_IOCP_EVENT_N, |
144 #endif | 151 #endif |
145 NGX_DUMMY_EVENT_N /* avoid comma at end of enumerator list */ | 152 NGX_DUMMY_EVENT_N /* avoid comma at end of enumerator list */ |
146 } ngx_event_type_e ; | 153 } ngx_event_type_e ; |
147 | 154 #endif |
148 | 155 |
149 | 156 |
150 typedef struct { | 157 typedef struct { |
151 int (*add)(ngx_event_t *ev, int event, u_int flags); | 158 int (*add)(ngx_event_t *ev, int event, u_int flags); |
152 int (*del)(ngx_event_t *ev, int event, u_int flags); | 159 int (*del)(ngx_event_t *ev, int event, u_int flags); |
163 } ngx_event_actions_t; | 170 } ngx_event_actions_t; |
164 | 171 |
165 | 172 |
166 /* The event filter requires to read/write the whole data - | 173 /* The event filter requires to read/write the whole data - |
167 select, poll, /dev/poll, kqueue. */ | 174 select, poll, /dev/poll, kqueue. */ |
168 #define NGX_HAVE_LEVEL_EVENT 1 | 175 #define NGX_HAVE_LEVEL_EVENT 0x00000001 |
169 | 176 |
170 /* The event filter is deleted after a notification without an additional | 177 /* The event filter is deleted after a notification without an additional |
171 syscall - select, poll, kqueue. */ | 178 syscall - select, poll, kqueue. */ |
172 #define NGX_HAVE_ONESHOT_EVENT 2 | 179 #define NGX_HAVE_ONESHOT_EVENT 0x00000002 |
173 | 180 |
174 /* The event filter notifies only the changes and an initial level - kqueue */ | 181 /* The event filter notifies only the changes and an initial level - kqueue */ |
175 #define NGX_HAVE_CLEAR_EVENT 4 | 182 #define NGX_HAVE_CLEAR_EVENT 0x00000004 |
176 | 183 |
177 /* The event filter has kqueue features - the eof flag, errno, | 184 /* The event filter has kqueue features - the eof flag, errno, |
178 available data, etc */ | 185 available data, etc */ |
179 #define NGX_HAVE_KQUEUE_EVENT 8 | 186 #define NGX_HAVE_KQUEUE_EVENT 0x00000008 |
180 | 187 |
181 /* The event filter supports low water mark - kqueue's NOTE_LOWAT. | 188 /* The event filter supports low water mark - kqueue's NOTE_LOWAT. |
182 kqueue in FreeBSD 4.1-4.2 has no NOTE_LOWAT so we need a separate flag */ | 189 kqueue in FreeBSD 4.1-4.2 has no NOTE_LOWAT so we need a separate flag */ |
183 #define NGX_HAVE_LOWAT_EVENT 0x00000010 | 190 #define NGX_HAVE_LOWAT_EVENT 0x00000010 |
184 | 191 |
205 Has no meaning for select, poll, epoll. | 212 Has no meaning for select, poll, epoll. |
206 | 213 |
207 kqueue: kqueue deletes event filters for file that closed | 214 kqueue: kqueue deletes event filters for file that closed |
208 so we need only to delete filters in user-level batch array | 215 so we need only to delete filters in user-level batch array |
209 /dev/poll: we need to flush POLLREMOVE event before closing file */ | 216 /dev/poll: we need to flush POLLREMOVE event before closing file */ |
217 | |
210 #define NGX_CLOSE_EVENT 1 | 218 #define NGX_CLOSE_EVENT 1 |
211 | 219 |
212 | 220 |
213 #if (HAVE_KQUEUE) | 221 #if (HAVE_KQUEUE) |
214 | 222 |
215 #define NGX_READ_EVENT EVFILT_READ | 223 #define NGX_READ_EVENT EVFILT_READ |
216 #define NGX_WRITE_EVENT EVFILT_WRITE | 224 #define NGX_WRITE_EVENT EVFILT_WRITE |
217 | |
218 #define NGX_ENABLE_EVENT EV_ENABLE | |
219 #define NGX_DISABLE_EVENT EV_DISABLE | |
220 | 225 |
221 /* NGX_CLOSE_EVENT is the module flag and it would not go into a kernel | 226 /* NGX_CLOSE_EVENT is the module flag and it would not go into a kernel |
222 so we need to choose the value that would not interfere with any existent | 227 so we need to choose the value that would not interfere with any existent |
223 and future flags. kqueue has such values - EV_FLAG1, EV_EOF and EV_ERROR. | 228 and future flags. kqueue has such values - EV_FLAG1, EV_EOF and EV_ERROR. |
224 They are reserved and cleared on a kernel entrance */ | 229 They are reserved and cleared on a kernel entrance */ |
250 #define NGX_LEVEL_EVENT 0 | 255 #define NGX_LEVEL_EVENT 0 |
251 #define NGX_ONESHOT_EVENT 1 | 256 #define NGX_ONESHOT_EVENT 1 |
252 | 257 |
253 #endif /* HAVE_KQUEUE */ | 258 #endif /* HAVE_KQUEUE */ |
254 | 259 |
260 #ifndef NGX_CLEAR_EVENT | |
261 #define NGX_CLEAR_EVENT 0 /* dummy */ | |
262 #endif | |
263 | |
255 #if (USE_KQUEUE) | 264 #if (USE_KQUEUE) |
256 | 265 |
257 #define ngx_init_events ngx_kqueue_init | 266 #define ngx_init_events ngx_kqueue_init |
258 #define ngx_process_events ngx_kqueue_process_events | 267 #define ngx_process_events ngx_kqueue_process_events |
259 #define ngx_add_event ngx_kqueue_add_event | 268 #define ngx_add_event ngx_kqueue_add_event |
315 #define NGX_EVENT_MODULE 0 | 324 #define NGX_EVENT_MODULE 0 |
316 | 325 |
317 | 326 |
318 typedef struct { | 327 typedef struct { |
319 int connections; | 328 int connections; |
329 int timer_queues; | |
320 int type; | 330 int type; |
321 int timer_queues; | |
322 } ngx_event_conf_t; | 331 } ngx_event_conf_t; |
323 | 332 |
324 | 333 |
325 typedef struct { | 334 typedef struct { |
326 int index; | 335 int index; |