comparison src/event/modules/ngx_epoll_module.c @ 326:f70f2f565fe0 NGINX_0_5_33

nginx 0.5.33 *) Change: now by default the "echo" SSI command uses entity encoding. *) Feature: the "encoding" parameter in the "echo" SSI command. *) Change: mail proxy was split on three modules: pop3, imap and smtp. *) Feature: the --without-mail_pop3_module, --without-mail_imap_module, and --without-mail_smtp_module configuration parameters. *) Feature: the "smtp_greeting_delay" and "smtp_client_buffer" directives of the ngx_mail_smtp_module. *) Feature: the "server_name" and "valid_referers" directives support regular expressions. *) Feature: the "server_name", "map", and "valid_referers" directives support the "www.example.*" wildcards. *) Bugfix: sub_filter did not work with empty substitution. *) Bugfix: in sub_filter parsing. *) Bugfix: a worker process may got caught in an endless loop, if the memcached was used. *) Bugfix: nginx supported low case only "close" and "keep-alive" values in the "Connection" request header line; bug appeared in 0.5.32. *) Bugfix: nginx could not start on Solaris if the shared PCRE library located in non-standard place was used.
author Igor Sysoev <http://sysoev.ru>
date Wed, 07 Nov 2007 00:00:00 +0300
parents 56688ed172c8
children
comparison
equal deleted inserted replaced
325:5bb1b28ddeaa 326:f70f2f565fe0
64 64
65 #endif 65 #endif
66 66
67 67
68 typedef struct { 68 typedef struct {
69 u_int events; 69 ngx_uint_t events;
70 } ngx_epoll_conf_t; 70 } ngx_epoll_conf_t;
71 71
72 72
73 static ngx_int_t ngx_epoll_init(ngx_cycle_t *cycle, ngx_msec_t timer); 73 static ngx_int_t ngx_epoll_init(ngx_cycle_t *cycle, ngx_msec_t timer);
74 static void ngx_epoll_done(ngx_cycle_t *cycle); 74 static void ngx_epoll_done(ngx_cycle_t *cycle);
75 static ngx_int_t ngx_epoll_add_event(ngx_event_t *ev, int event, u_int flags); 75 static ngx_int_t ngx_epoll_add_event(ngx_event_t *ev, ngx_int_t event,
76 static ngx_int_t ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags); 76 ngx_uint_t flags);
77 static ngx_int_t ngx_epoll_del_event(ngx_event_t *ev, ngx_int_t event,
78 ngx_uint_t flags);
77 static ngx_int_t ngx_epoll_add_connection(ngx_connection_t *c); 79 static ngx_int_t ngx_epoll_add_connection(ngx_connection_t *c);
78 static ngx_int_t ngx_epoll_del_connection(ngx_connection_t *c, u_int flags); 80 static ngx_int_t ngx_epoll_del_connection(ngx_connection_t *c,
81 ngx_uint_t flags);
79 static ngx_int_t ngx_epoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, 82 static ngx_int_t ngx_epoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
80 ngx_uint_t flags); 83 ngx_uint_t flags);
81 84
82 static void *ngx_epoll_create_conf(ngx_cycle_t *cycle); 85 static void *ngx_epoll_create_conf(ngx_cycle_t *cycle);
83 static char *ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf); 86 static char *ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf);
84 87
85 static int ep = -1; 88 static int ep = -1;
86 static struct epoll_event *event_list; 89 static struct epoll_event *event_list;
87 static u_int nevents; 90 static ngx_uint_t nevents;
88 91
89 92
90 static ngx_str_t epoll_name = ngx_string("epoll"); 93 static ngx_str_t epoll_name = ngx_string("epoll");
91 94
92 static ngx_command_t ngx_epoll_commands[] = { 95 static ngx_command_t ngx_epoll_commands[] = {
203 nevents = 0; 206 nevents = 0;
204 } 207 }
205 208
206 209
207 static ngx_int_t 210 static ngx_int_t
208 ngx_epoll_add_event(ngx_event_t *ev, int event, u_int flags) 211 ngx_epoll_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
209 { 212 {
210 int op; 213 int op;
211 uint32_t events, prev; 214 uint32_t events, prev;
212 ngx_event_t *e; 215 ngx_event_t *e;
213 ngx_connection_t *c; 216 ngx_connection_t *c;
238 241
239 } else { 242 } else {
240 op = EPOLL_CTL_ADD; 243 op = EPOLL_CTL_ADD;
241 } 244 }
242 245
243 ee.events = events | flags; 246 ee.events = events | (uint32_t) flags;
244 ee.data.ptr = (void *) ((uintptr_t) c | ev->instance); 247 ee.data.ptr = (void *) ((uintptr_t) c | ev->instance);
245 248
246 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0, 249 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
247 "epoll add event: fd:%d op:%d ev:%08XD", 250 "epoll add event: fd:%d op:%d ev:%08XD",
248 c->fd, op, ee.events); 251 c->fd, op, ee.events);
261 return NGX_OK; 264 return NGX_OK;
262 } 265 }
263 266
264 267
265 static ngx_int_t 268 static ngx_int_t
266 ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags) 269 ngx_epoll_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
267 { 270 {
268 int op; 271 int op;
269 uint32_t prev; 272 uint32_t prev;
270 ngx_event_t *e; 273 ngx_event_t *e;
271 ngx_connection_t *c; 274 ngx_connection_t *c;
293 prev = EPOLLIN; 296 prev = EPOLLIN;
294 } 297 }
295 298
296 if (e->active) { 299 if (e->active) {
297 op = EPOLL_CTL_MOD; 300 op = EPOLL_CTL_MOD;
298 ee.events = prev | flags; 301 ee.events = prev | (uint32_t) flags;
299 ee.data.ptr = (void *) ((uintptr_t) c | ev->instance); 302 ee.data.ptr = (void *) ((uintptr_t) c | ev->instance);
300 303
301 } else { 304 } else {
302 op = EPOLL_CTL_DEL; 305 op = EPOLL_CTL_DEL;
303 ee.events = 0; 306 ee.events = 0;
343 return NGX_OK; 346 return NGX_OK;
344 } 347 }
345 348
346 349
347 static ngx_int_t 350 static ngx_int_t
348 ngx_epoll_del_connection(ngx_connection_t *c, u_int flags) 351 ngx_epoll_del_connection(ngx_connection_t *c, ngx_uint_t flags)
349 { 352 {
350 int op; 353 int op;
351 struct epoll_event ee; 354 struct epoll_event ee;
352 355
353 /* 356 /*
354 * when the file descriptor is closed the epoll automatically deletes 357 * when the file descriptor is closed the epoll automatically deletes
355 * it from its queue so we do not need to delete explicity the event 358 * it from its queue so we do not need to delete explicity the event
356 * before the closing the file descriptor 359 * before the closing the file descriptor
397 /* NGX_TIMER_INFINITE == INFTIM */ 400 /* NGX_TIMER_INFINITE == INFTIM */
398 401
399 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 402 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
400 "epoll timer: %M", timer); 403 "epoll timer: %M", timer);
401 404
402 events = epoll_wait(ep, event_list, nevents, timer); 405 events = epoll_wait(ep, event_list, (int) nevents, timer);
403 406
404 if (events == -1) { 407 if (events == -1) {
405 err = ngx_errno; 408 err = ngx_errno;
406 } else { 409 } else {
407 err = 0; 410 err = 0;