Mercurial > hg > nginx-vendor-0-6
comparison src/event/modules/ngx_epoll_module.c @ 48:6cfc63e68377 NGINX_0_1_24
nginx 0.1.24
*) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING
and DOCUMENT_URI variables.
*) Bugfix: the ngx_http_autoindex_module may some times return the 404
response for existent directory, if this directory was used in
"alias" directive.
*) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large
responses.
*) Bugfix: the lack of the "Referer" header line was always accounted
as valid referrer.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 04 Mar 2005 00:00:00 +0300 |
parents | da8c190bdaba |
children | 72eb30262aac |
comparison
equal
deleted
inserted
replaced
47:4ae32548452c | 48:6cfc63e68377 |
---|---|
68 typedef struct { | 68 typedef struct { |
69 u_int events; | 69 u_int events; |
70 } ngx_epoll_conf_t; | 70 } ngx_epoll_conf_t; |
71 | 71 |
72 | 72 |
73 static int ngx_epoll_init(ngx_cycle_t *cycle); | 73 static ngx_int_t ngx_epoll_init(ngx_cycle_t *cycle); |
74 static void ngx_epoll_done(ngx_cycle_t *cycle); | 74 static void ngx_epoll_done(ngx_cycle_t *cycle); |
75 static int 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, int event, u_int flags); |
76 static int ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags); | 76 static ngx_int_t ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags); |
77 static int ngx_epoll_add_connection(ngx_connection_t *c); | 77 static ngx_int_t ngx_epoll_add_connection(ngx_connection_t *c); |
78 static int ngx_epoll_del_connection(ngx_connection_t *c, u_int flags); | 78 static ngx_int_t ngx_epoll_del_connection(ngx_connection_t *c, u_int flags); |
79 static int ngx_epoll_process_events(ngx_cycle_t *cycle); | 79 static ngx_int_t ngx_epoll_process_events(ngx_cycle_t *cycle); |
80 | 80 |
81 static void *ngx_epoll_create_conf(ngx_cycle_t *cycle); | 81 static void *ngx_epoll_create_conf(ngx_cycle_t *cycle); |
82 static char *ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf); | 82 static char *ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf); |
83 | 83 |
84 static int ep = -1; | 84 static int ep = -1; |
88 | 88 |
89 static ngx_str_t epoll_name = ngx_string("epoll"); | 89 static ngx_str_t epoll_name = ngx_string("epoll"); |
90 | 90 |
91 static ngx_command_t ngx_epoll_commands[] = { | 91 static ngx_command_t ngx_epoll_commands[] = { |
92 | 92 |
93 {ngx_string("epoll_events"), | 93 { ngx_string("epoll_events"), |
94 NGX_EVENT_CONF|NGX_CONF_TAKE1, | 94 NGX_EVENT_CONF|NGX_CONF_TAKE1, |
95 ngx_conf_set_num_slot, | 95 ngx_conf_set_num_slot, |
96 0, | 96 0, |
97 offsetof(ngx_epoll_conf_t, events), | 97 offsetof(ngx_epoll_conf_t, events), |
98 NULL}, | 98 NULL }, |
99 | 99 |
100 ngx_null_command | 100 ngx_null_command |
101 }; | 101 }; |
102 | 102 |
103 | 103 |
104 ngx_event_module_t ngx_epoll_module_ctx = { | 104 ngx_event_module_t ngx_epoll_module_ctx = { |
105 &epoll_name, | 105 &epoll_name, |
128 NULL, /* init module */ | 128 NULL, /* init module */ |
129 NULL /* init process */ | 129 NULL /* init process */ |
130 }; | 130 }; |
131 | 131 |
132 | 132 |
133 static int ngx_epoll_init(ngx_cycle_t *cycle) | 133 static ngx_int_t |
134 ngx_epoll_init(ngx_cycle_t *cycle) | |
134 { | 135 { |
135 size_t n; | 136 size_t n; |
136 ngx_event_conf_t *ecf; | 137 ngx_event_conf_t *ecf; |
137 ngx_epoll_conf_t *epcf; | 138 ngx_epoll_conf_t *epcf; |
138 | 139 |
178 | 179 |
179 return NGX_OK; | 180 return NGX_OK; |
180 } | 181 } |
181 | 182 |
182 | 183 |
183 static void ngx_epoll_done(ngx_cycle_t *cycle) | 184 static void |
185 ngx_epoll_done(ngx_cycle_t *cycle) | |
184 { | 186 { |
185 if (close(ep) == -1) { | 187 if (close(ep) == -1) { |
186 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | 188 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
187 "epoll close() failed"); | 189 "epoll close() failed"); |
188 } | 190 } |
194 event_list = NULL; | 196 event_list = NULL; |
195 nevents = 0; | 197 nevents = 0; |
196 } | 198 } |
197 | 199 |
198 | 200 |
199 static int ngx_epoll_add_event(ngx_event_t *ev, int event, u_int flags) | 201 static ngx_int_t |
202 ngx_epoll_add_event(ngx_event_t *ev, int event, u_int flags) | |
200 { | 203 { |
201 int op; | 204 int op; |
202 uint32_t events, prev; | 205 uint32_t events, prev; |
203 ngx_event_t *e; | 206 ngx_event_t *e; |
204 ngx_connection_t *c; | 207 ngx_connection_t *c; |
251 | 254 |
252 return NGX_OK; | 255 return NGX_OK; |
253 } | 256 } |
254 | 257 |
255 | 258 |
256 static int ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags) | 259 static ngx_int_t |
260 ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags) | |
257 { | 261 { |
258 int op; | 262 int op; |
259 uint32_t prev; | 263 uint32_t prev; |
260 ngx_event_t *e; | 264 ngx_event_t *e; |
261 ngx_connection_t *c; | 265 ngx_connection_t *c; |
308 | 312 |
309 return NGX_OK; | 313 return NGX_OK; |
310 } | 314 } |
311 | 315 |
312 | 316 |
313 static int ngx_epoll_add_connection(ngx_connection_t *c) | 317 static ngx_int_t |
318 ngx_epoll_add_connection(ngx_connection_t *c) | |
314 { | 319 { |
315 struct epoll_event ee; | 320 struct epoll_event ee; |
316 | 321 |
317 ee.events = EPOLLIN|EPOLLOUT|EPOLLET; | 322 ee.events = EPOLLIN|EPOLLOUT|EPOLLET; |
318 ee.data.u64 = (uintptr_t) c | c->read->instance; | 323 ee.data.u64 = (uintptr_t) c | c->read->instance; |
331 | 336 |
332 return NGX_OK; | 337 return NGX_OK; |
333 } | 338 } |
334 | 339 |
335 | 340 |
336 static int ngx_epoll_del_connection(ngx_connection_t *c, u_int flags) | 341 static ngx_int_t |
342 ngx_epoll_del_connection(ngx_connection_t *c, u_int flags) | |
337 { | 343 { |
338 int op; | 344 int op; |
339 struct epoll_event ee; | 345 struct epoll_event ee; |
340 | 346 |
341 /* | 347 /* |
368 | 374 |
369 return NGX_OK; | 375 return NGX_OK; |
370 } | 376 } |
371 | 377 |
372 | 378 |
373 int ngx_epoll_process_events(ngx_cycle_t *cycle) | 379 static ngx_int_t |
380 ngx_epoll_process_events(ngx_cycle_t *cycle) | |
374 { | 381 { |
375 int events; | 382 int events; |
376 size_t n; | 383 size_t n; |
377 uint32_t revents; | 384 uint32_t revents; |
378 ngx_int_t instance, i; | 385 ngx_int_t instance, i; |
649 | 656 |
650 return NGX_OK; | 657 return NGX_OK; |
651 } | 658 } |
652 | 659 |
653 | 660 |
654 static void *ngx_epoll_create_conf(ngx_cycle_t *cycle) | 661 static void * |
662 ngx_epoll_create_conf(ngx_cycle_t *cycle) | |
655 { | 663 { |
656 ngx_epoll_conf_t *epcf; | 664 ngx_epoll_conf_t *epcf; |
657 | 665 |
658 ngx_test_null(epcf, ngx_palloc(cycle->pool, sizeof(ngx_epoll_conf_t)), | 666 ngx_test_null(epcf, ngx_palloc(cycle->pool, sizeof(ngx_epoll_conf_t)), |
659 NGX_CONF_ERROR); | 667 NGX_CONF_ERROR); |
662 | 670 |
663 return epcf; | 671 return epcf; |
664 } | 672 } |
665 | 673 |
666 | 674 |
667 static char *ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf) | 675 static char * |
676 ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf) | |
668 { | 677 { |
669 ngx_epoll_conf_t *epcf = conf; | 678 ngx_epoll_conf_t *epcf = conf; |
670 | 679 |
671 ngx_conf_init_unsigned_value(epcf->events, 512); | 680 ngx_conf_init_unsigned_value(epcf->events, 512); |
672 | 681 |