comparison src/event/modules/ngx_rtsig_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 41ccba1aba45
children 72eb30262aac
comparison
equal deleted inserted replaced
47:4ae32548452c 48:6cfc63e68377
46 static ngx_int_t ngx_rtsig_process_overflow(ngx_cycle_t *cycle); 46 static ngx_int_t ngx_rtsig_process_overflow(ngx_cycle_t *cycle);
47 47
48 static void *ngx_rtsig_create_conf(ngx_cycle_t *cycle); 48 static void *ngx_rtsig_create_conf(ngx_cycle_t *cycle);
49 static char *ngx_rtsig_init_conf(ngx_cycle_t *cycle, void *conf); 49 static char *ngx_rtsig_init_conf(ngx_cycle_t *cycle, void *conf);
50 static char *ngx_check_ngx_overflow_threshold_bounds(ngx_conf_t *cf, 50 static char *ngx_check_ngx_overflow_threshold_bounds(ngx_conf_t *cf,
51 void *post, void *data); 51 void *post, void *data);
52 52
53 53
54 static sigset_t set; 54 static sigset_t set;
55 static ngx_uint_t overflow, overflow_current; 55 static ngx_uint_t overflow, overflow_current;
56 static struct pollfd *overflow_list; 56 static struct pollfd *overflow_list;
63 }; 63 };
64 64
65 65
66 static ngx_command_t ngx_rtsig_commands[] = { 66 static ngx_command_t ngx_rtsig_commands[] = {
67 67
68 {ngx_string("rtsig_signo"), 68 { ngx_string("rtsig_signo"),
69 NGX_EVENT_CONF|NGX_CONF_TAKE1, 69 NGX_EVENT_CONF|NGX_CONF_TAKE1,
70 ngx_conf_set_num_slot, 70 ngx_conf_set_num_slot,
71 0, 71 0,
72 offsetof(ngx_rtsig_conf_t, signo), 72 offsetof(ngx_rtsig_conf_t, signo),
73 NULL}, 73 NULL },
74 74
75 {ngx_string("rtsig_overflow_events"), 75 { ngx_string("rtsig_overflow_events"),
76 NGX_EVENT_CONF|NGX_CONF_TAKE1, 76 NGX_EVENT_CONF|NGX_CONF_TAKE1,
77 ngx_conf_set_num_slot, 77 ngx_conf_set_num_slot,
78 0, 78 0,
79 offsetof(ngx_rtsig_conf_t, overflow_events), 79 offsetof(ngx_rtsig_conf_t, overflow_events),
80 NULL}, 80 NULL },
81 81
82 {ngx_string("rtsig_overflow_test"), 82 { ngx_string("rtsig_overflow_test"),
83 NGX_EVENT_CONF|NGX_CONF_TAKE1, 83 NGX_EVENT_CONF|NGX_CONF_TAKE1,
84 ngx_conf_set_num_slot, 84 ngx_conf_set_num_slot,
85 0, 85 0,
86 offsetof(ngx_rtsig_conf_t, overflow_test), 86 offsetof(ngx_rtsig_conf_t, overflow_test),
87 NULL}, 87 NULL },
88 88
89 {ngx_string("rtsig_overflow_threshold"), 89 { ngx_string("rtsig_overflow_threshold"),
90 NGX_EVENT_CONF|NGX_CONF_TAKE1, 90 NGX_EVENT_CONF|NGX_CONF_TAKE1,
91 ngx_conf_set_num_slot, 91 ngx_conf_set_num_slot,
92 0, 92 0,
93 offsetof(ngx_rtsig_conf_t, overflow_threshold), 93 offsetof(ngx_rtsig_conf_t, overflow_threshold),
94 &ngx_overflow_threshold_bounds}, 94 &ngx_overflow_threshold_bounds },
95 95
96 ngx_null_command 96 ngx_null_command
97 }; 97 };
98 98
99 99
100 ngx_event_module_t ngx_rtsig_module_ctx = { 100 ngx_event_module_t ngx_rtsig_module_ctx = {
101 &rtsig_name, 101 &rtsig_name,
119 119
120 ngx_module_t ngx_rtsig_module = { 120 ngx_module_t ngx_rtsig_module = {
121 NGX_MODULE, 121 NGX_MODULE,
122 &ngx_rtsig_module_ctx, /* module context */ 122 &ngx_rtsig_module_ctx, /* module context */
123 ngx_rtsig_commands, /* module directives */ 123 ngx_rtsig_commands, /* module directives */
124 NGX_EVENT_MODULE, /* module type */ 124 NGX_EVENT_MODULE, /* module type */
125 NULL, /* init module */ 125 NULL, /* init module */
126 NULL /* init process */ 126 NULL /* init process */
127 }; 127 };
128 128
129 129
130 static ngx_int_t ngx_rtsig_init(ngx_cycle_t *cycle) 130 static ngx_int_t
131 ngx_rtsig_init(ngx_cycle_t *cycle)
131 { 132 {
132 ngx_rtsig_conf_t *rtscf; 133 ngx_rtsig_conf_t *rtscf;
133 134
134 rtscf = ngx_event_get_conf(cycle->conf_ctx, ngx_rtsig_module); 135 rtscf = ngx_event_get_conf(cycle->conf_ctx, ngx_rtsig_module);
135 136
162 163
163 return NGX_OK; 164 return NGX_OK;
164 } 165 }
165 166
166 167
167 static void ngx_rtsig_done(ngx_cycle_t *cycle) 168 static void
169 ngx_rtsig_done(ngx_cycle_t *cycle)
168 { 170 {
169 ngx_free(overflow_list); 171 ngx_free(overflow_list);
170 172
171 overflow_list = NULL; 173 overflow_list = NULL;
172 } 174 }
173 175
174 176
175 static ngx_int_t ngx_rtsig_add_connection(ngx_connection_t *c) 177 static ngx_int_t
178 ngx_rtsig_add_connection(ngx_connection_t *c)
176 { 179 {
177 int signo; 180 int signo;
178 ngx_rtsig_conf_t *rtscf; 181 ngx_rtsig_conf_t *rtscf;
179 182
180 if (c->read->accept && c->read->disabled) { 183 if (c->read->accept && c->read->disabled) {
230 233
231 return NGX_OK; 234 return NGX_OK;
232 } 235 }
233 236
234 237
235 static ngx_int_t ngx_rtsig_del_connection(ngx_connection_t *c, u_int flags) 238 static ngx_int_t
239 ngx_rtsig_del_connection(ngx_connection_t *c, u_int flags)
236 { 240 {
237 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 241 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
238 "rtsig del connection: fd:%d", c->fd); 242 "rtsig del connection: fd:%d", c->fd);
239 243
240 if ((flags & NGX_DISABLE_EVENT) && c->read->accept) { 244 if ((flags & NGX_DISABLE_EVENT) && c->read->accept) {
264 268
265 return NGX_OK; 269 return NGX_OK;
266 } 270 }
267 271
268 272
269 ngx_int_t ngx_rtsig_process_events(ngx_cycle_t *cycle) 273 static ngx_int_t
274 ngx_rtsig_process_events(ngx_cycle_t *cycle)
270 { 275 {
271 int signo; 276 int signo;
272 ngx_int_t instance, i; 277 ngx_int_t instance, i;
273 ngx_uint_t expire; 278 ngx_uint_t expire;
274 size_t n; 279 size_t n;
560 } 565 }
561 566
562 567
563 /* TODO: old cylces */ 568 /* TODO: old cylces */
564 569
565 static ngx_int_t ngx_rtsig_process_overflow(ngx_cycle_t *cycle) 570 static ngx_int_t
571 ngx_rtsig_process_overflow(ngx_cycle_t *cycle)
566 { 572 {
567 int name[2], rtsig_max, rtsig_nr, events, ready; 573 int name[2], rtsig_max, rtsig_nr, events, ready;
568 size_t len; 574 size_t len;
569 ngx_int_t tested, n, i; 575 ngx_int_t tested, n, i;
570 ngx_err_t err; 576 ngx_err_t err;
764 770
765 return NGX_OK; 771 return NGX_OK;
766 } 772 }
767 773
768 774
769 static void *ngx_rtsig_create_conf(ngx_cycle_t *cycle) 775 static void *
776 ngx_rtsig_create_conf(ngx_cycle_t *cycle)
770 { 777 {
771 ngx_rtsig_conf_t *rtscf; 778 ngx_rtsig_conf_t *rtscf;
772 779
773 ngx_test_null(rtscf, ngx_palloc(cycle->pool, sizeof(ngx_rtsig_conf_t)), 780 ngx_test_null(rtscf, ngx_palloc(cycle->pool, sizeof(ngx_rtsig_conf_t)),
774 NGX_CONF_ERROR); 781 NGX_CONF_ERROR);
780 787
781 return rtscf; 788 return rtscf;
782 } 789 }
783 790
784 791
785 static char *ngx_rtsig_init_conf(ngx_cycle_t *cycle, void *conf) 792 static char *
793 ngx_rtsig_init_conf(ngx_cycle_t *cycle, void *conf)
786 { 794 {
787 ngx_rtsig_conf_t *rtscf = conf; 795 ngx_rtsig_conf_t *rtscf = conf;
788 796
789 /* LinuxThreads use the first 3 RT signals */ 797 /* LinuxThreads use the first 3 RT signals */
790 ngx_conf_init_value(rtscf->signo, SIGRTMIN + 10); 798 ngx_conf_init_value(rtscf->signo, SIGRTMIN + 10);
795 803
796 return NGX_CONF_OK; 804 return NGX_CONF_OK;
797 } 805 }
798 806
799 807
800 static char *ngx_check_ngx_overflow_threshold_bounds(ngx_conf_t *cf, 808 static char *
809 ngx_check_ngx_overflow_threshold_bounds(ngx_conf_t *cf,
801 void *post, void *data) 810 void *post, void *data)
802 { 811 {
803 if (ngx_linux_rtsig_max) { 812 if (ngx_linux_rtsig_max) {
804 return ngx_conf_check_num_bounds(cf, post, data); 813 return ngx_conf_check_num_bounds(cf, post, data);
805 } 814 }