comparison src/event/modules/ngx_kqueue_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 2879cd3a40cb
children 72eb30262aac
comparison
equal deleted inserted replaced
47:4ae32548452c 48:6cfc63e68377
22 static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags); 22 static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags);
23 static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags); 23 static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags);
24 static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try); 24 static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try);
25 static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle); 25 static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle);
26 static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log, 26 static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log,
27 struct kevent *kev); 27 struct kevent *kev);
28 28
29 static void *ngx_kqueue_create_conf(ngx_cycle_t *cycle); 29 static void *ngx_kqueue_create_conf(ngx_cycle_t *cycle);
30 static char *ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf); 30 static char *ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf);
31 31
32 32
53 53
54 static ngx_str_t kqueue_name = ngx_string("kqueue"); 54 static ngx_str_t kqueue_name = ngx_string("kqueue");
55 55
56 static ngx_command_t ngx_kqueue_commands[] = { 56 static ngx_command_t ngx_kqueue_commands[] = {
57 57
58 {ngx_string("kqueue_changes"), 58 { ngx_string("kqueue_changes"),
59 NGX_EVENT_CONF|NGX_CONF_TAKE1, 59 NGX_EVENT_CONF|NGX_CONF_TAKE1,
60 ngx_conf_set_num_slot, 60 ngx_conf_set_num_slot,
61 0, 61 0,
62 offsetof(ngx_kqueue_conf_t, changes), 62 offsetof(ngx_kqueue_conf_t, changes),
63 NULL}, 63 NULL },
64 64
65 {ngx_string("kqueue_events"), 65 { ngx_string("kqueue_events"),
66 NGX_EVENT_CONF|NGX_CONF_TAKE1, 66 NGX_EVENT_CONF|NGX_CONF_TAKE1,
67 ngx_conf_set_num_slot, 67 ngx_conf_set_num_slot,
68 0, 68 0,
69 offsetof(ngx_kqueue_conf_t, events), 69 offsetof(ngx_kqueue_conf_t, events),
70 NULL}, 70 NULL },
71 71
72 ngx_null_command 72 ngx_null_command
73 }; 73 };
74 74
75 75
76 ngx_event_module_t ngx_kqueue_module_ctx = { 76 ngx_event_module_t ngx_kqueue_module_ctx = {
77 &kqueue_name, 77 &kqueue_name,
102 NULL /* init process */ 102 NULL /* init process */
103 }; 103 };
104 104
105 105
106 106
107 static ngx_int_t ngx_kqueue_init(ngx_cycle_t *cycle) 107 static ngx_int_t
108 ngx_kqueue_init(ngx_cycle_t *cycle)
108 { 109 {
109 struct timespec ts; 110 struct timespec ts;
110 ngx_kqueue_conf_t *kcf; 111 ngx_kqueue_conf_t *kcf;
111 112
112 kcf = ngx_event_get_conf(cycle->conf_ctx, ngx_kqueue_module); 113 kcf = ngx_event_get_conf(cycle->conf_ctx, ngx_kqueue_module);
201 202
202 return NGX_OK; 203 return NGX_OK;
203 } 204 }
204 205
205 206
206 static void ngx_kqueue_done(ngx_cycle_t *cycle) 207 static void
208 ngx_kqueue_done(ngx_cycle_t *cycle)
207 { 209 {
208 if (close(ngx_kqueue) == -1) { 210 if (close(ngx_kqueue) == -1) {
209 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 211 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
210 "kqueue close() failed"); 212 "kqueue close() failed");
211 } 213 }
229 nchanges = 0; 231 nchanges = 0;
230 nevents = 0; 232 nevents = 0;
231 } 233 }
232 234
233 235
234 static ngx_int_t ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags) 236 static ngx_int_t
237 ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags)
235 { 238 {
236 ngx_int_t rc; 239 ngx_int_t rc;
237 ngx_event_t *e; 240 ngx_event_t *e;
238 ngx_connection_t *c; 241 ngx_connection_t *c;
239 242
293 296
294 return rc; 297 return rc;
295 } 298 }
296 299
297 300
298 static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags) 301 static ngx_int_t
302 ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags)
299 { 303 {
300 ngx_int_t rc; 304 ngx_int_t rc;
301 ngx_event_t *e; 305 ngx_event_t *e;
302 306
303 ev->active = 0; 307 ev->active = 0;
356 360
357 return rc; 361 return rc;
358 } 362 }
359 363
360 364
361 static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags) 365 static ngx_int_t
366 ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags)
362 { 367 {
363 struct kevent *kev; 368 struct kevent *kev;
364 struct timespec ts; 369 struct timespec ts;
365 ngx_connection_t *c; 370 ngx_connection_t *c;
366 371
423 428
424 return NGX_OK; 429 return NGX_OK;
425 } 430 }
426 431
427 432
428 static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle) 433 static ngx_int_t
434 ngx_kqueue_process_events(ngx_cycle_t *cycle)
429 { 435 {
430 int events, n; 436 int events, n;
431 ngx_int_t i, instance; 437 ngx_int_t i, instance;
432 ngx_uint_t lock, accept_lock, expire; 438 ngx_uint_t lock, accept_lock, expire;
433 ngx_err_t err; 439 ngx_err_t err;
713 719
714 return NGX_OK; 720 return NGX_OK;
715 } 721 }
716 722
717 723
718 static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try) 724 static ngx_int_t
725 ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try)
719 { 726 {
720 int n; 727 int n;
721 ngx_int_t rc; 728 ngx_int_t rc;
722 ngx_err_t err; 729 ngx_err_t err;
723 struct timespec ts; 730 struct timespec ts;
770 777
771 return rc; 778 return rc;
772 } 779 }
773 780
774 781
775 static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev) 782 static ngx_inline void
783 ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev)
776 { 784 {
777 ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0, 785 ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0,
778 (kev->ident > 0x8000000 && kev->ident != (unsigned) -1) ? 786 (kev->ident > 0x8000000 && kev->ident != (unsigned) -1) ?
779 "kevent: %p: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p": 787 "kevent: %p: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p":
780 "kevent: %d: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p", 788 "kevent: %d: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p",
782 kev->flags, kev->fflags, 790 kev->flags, kev->fflags,
783 kev->data, kev->udata); 791 kev->data, kev->udata);
784 } 792 }
785 793
786 794
787 static void *ngx_kqueue_create_conf(ngx_cycle_t *cycle) 795 static void *
796 ngx_kqueue_create_conf(ngx_cycle_t *cycle)
788 { 797 {
789 ngx_kqueue_conf_t *kcf; 798 ngx_kqueue_conf_t *kcf;
790 799
791 ngx_test_null(kcf, ngx_palloc(cycle->pool, sizeof(ngx_kqueue_conf_t)), 800 ngx_test_null(kcf, ngx_palloc(cycle->pool, sizeof(ngx_kqueue_conf_t)),
792 NGX_CONF_ERROR); 801 NGX_CONF_ERROR);
796 805
797 return kcf; 806 return kcf;
798 } 807 }
799 808
800 809
801 static char *ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf) 810 static char *
811 ngx_kqueue_init_conf(ngx_cycle_t *cycle, void *conf)
802 { 812 {
803 ngx_kqueue_conf_t *kcf = conf; 813 ngx_kqueue_conf_t *kcf = conf;
804 814
805 ngx_conf_init_value(kcf->changes, 512); 815 ngx_conf_init_value(kcf->changes, 512);
806 ngx_conf_init_value(kcf->events, 512); 816 ngx_conf_init_value(kcf->events, 512);