Mercurial > hg > nginx-vendor-current
comparison src/event/ngx_event.c @ 672:f41d4b305d22 NGINX_1_2_0
nginx 1.2.0
*) Bugfix: a segmentation fault might occur in a worker process if the
"try_files" directive was used; the bug had appeared in 1.1.19.
*) Bugfix: response might be truncated if there were more than IOV_MAX
buffers used.
*) Bugfix: in the "crop" parameter of the "image_filter" directive.
Thanks to Maxim Bublis.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 23 Apr 2012 00:00:00 +0400 |
parents | d0f7a625f27c |
children | 4dcaf40cc702 |
comparison
equal
deleted
inserted
replaced
671:47cb3497fbab | 672:f41d4b305d22 |
---|---|
19 extern ngx_module_t ngx_epoll_module; | 19 extern ngx_module_t ngx_epoll_module; |
20 extern ngx_module_t ngx_rtsig_module; | 20 extern ngx_module_t ngx_rtsig_module; |
21 extern ngx_module_t ngx_select_module; | 21 extern ngx_module_t ngx_select_module; |
22 | 22 |
23 | 23 |
24 static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf); | |
24 static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle); | 25 static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle); |
25 static ngx_int_t ngx_event_process_init(ngx_cycle_t *cycle); | 26 static ngx_int_t ngx_event_process_init(ngx_cycle_t *cycle); |
26 static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | 27 static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
27 | 28 |
28 static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd, | 29 static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd, |
29 void *conf); | 30 void *conf); |
30 static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | 31 static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
31 static char *ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, | 32 static char *ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, |
32 void *conf); | 33 void *conf); |
33 | 34 |
34 static void *ngx_event_create_conf(ngx_cycle_t *cycle); | 35 static void *ngx_event_core_create_conf(ngx_cycle_t *cycle); |
35 static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf); | 36 static char *ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf); |
36 | 37 |
37 | 38 |
38 static ngx_uint_t ngx_timer_resolution; | 39 static ngx_uint_t ngx_timer_resolution; |
39 sig_atomic_t ngx_event_timer_alarm; | 40 sig_atomic_t ngx_event_timer_alarm; |
40 | 41 |
91 | 92 |
92 | 93 |
93 static ngx_core_module_t ngx_events_module_ctx = { | 94 static ngx_core_module_t ngx_events_module_ctx = { |
94 ngx_string("events"), | 95 ngx_string("events"), |
95 NULL, | 96 NULL, |
96 NULL | 97 ngx_event_init_conf |
97 }; | 98 }; |
98 | 99 |
99 | 100 |
100 ngx_module_t ngx_events_module = { | 101 ngx_module_t ngx_events_module = { |
101 NGX_MODULE_V1, | 102 NGX_MODULE_V1, |
171 }; | 172 }; |
172 | 173 |
173 | 174 |
174 ngx_event_module_t ngx_event_core_module_ctx = { | 175 ngx_event_module_t ngx_event_core_module_ctx = { |
175 &event_core_name, | 176 &event_core_name, |
176 ngx_event_create_conf, /* create configuration */ | 177 ngx_event_core_create_conf, /* create configuration */ |
177 ngx_event_init_conf, /* init configuration */ | 178 ngx_event_core_init_conf, /* init configuration */ |
178 | 179 |
179 { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } | 180 { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } |
180 }; | 181 }; |
181 | 182 |
182 | 183 |
421 | 422 |
422 return NGX_OK; | 423 return NGX_OK; |
423 } | 424 } |
424 | 425 |
425 | 426 |
427 static char * | |
428 ngx_event_init_conf(ngx_cycle_t *cycle, void *conf) | |
429 { | |
430 if (ngx_get_conf(cycle->conf_ctx, ngx_events_module) == NULL) { | |
431 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, | |
432 "no \"events\" section in configuration"); | |
433 return NGX_CONF_ERROR; | |
434 } | |
435 | |
436 return NGX_CONF_OK; | |
437 } | |
438 | |
439 | |
426 static ngx_int_t | 440 static ngx_int_t |
427 ngx_event_module_init(ngx_cycle_t *cycle) | 441 ngx_event_module_init(ngx_cycle_t *cycle) |
428 { | 442 { |
429 void ***cf; | 443 void ***cf; |
430 u_char *shared; | 444 u_char *shared; |
433 ngx_time_t *tp; | 447 ngx_time_t *tp; |
434 ngx_core_conf_t *ccf; | 448 ngx_core_conf_t *ccf; |
435 ngx_event_conf_t *ecf; | 449 ngx_event_conf_t *ecf; |
436 | 450 |
437 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module); | 451 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module); |
438 | |
439 if (cf == NULL) { | |
440 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, | |
441 "no \"events\" section in configuration"); | |
442 return NGX_ERROR; | |
443 } | |
444 | |
445 ecf = (*cf)[ngx_event_core_module.ctx_index]; | 452 ecf = (*cf)[ngx_event_core_module.ctx_index]; |
446 | 453 |
447 if (!ngx_test_config && ngx_process <= NGX_PROCESS_MASTER) { | 454 if (!ngx_test_config && ngx_process <= NGX_PROCESS_MASTER) { |
448 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, | 455 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, |
449 "using the \"%s\" event method", ecf->name); | 456 "using the \"%s\" event method", ecf->name); |
469 { | 476 { |
470 limit = (ccf->rlimit_nofile == NGX_CONF_UNSET) ? | 477 limit = (ccf->rlimit_nofile == NGX_CONF_UNSET) ? |
471 (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile; | 478 (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile; |
472 | 479 |
473 ngx_log_error(NGX_LOG_WARN, cycle->log, 0, | 480 ngx_log_error(NGX_LOG_WARN, cycle->log, 0, |
474 "%ui worker_connections are more than " | 481 "%ui worker_connections exceed " |
475 "open file resource limit: %i", | 482 "open file resource limit: %i", |
476 ecf->connections, limit); | 483 ecf->connections, limit); |
477 } | 484 } |
478 } | 485 } |
479 } | 486 } |
487 if (ngx_accept_mutex_ptr) { | 494 if (ngx_accept_mutex_ptr) { |
488 return NGX_OK; | 495 return NGX_OK; |
489 } | 496 } |
490 | 497 |
491 | 498 |
492 /* cl should be equal or bigger than cache line size */ | 499 /* cl should be equal to or greater than cache line size */ |
493 | 500 |
494 cl = 128; | 501 cl = 128; |
495 | 502 |
496 size = cl /* ngx_accept_mutex */ | 503 size = cl /* ngx_accept_mutex */ |
497 + cl /* ngx_connection_counter */ | 504 + cl /* ngx_connection_counter */ |
1114 return NGX_CONF_OK; | 1121 return NGX_CONF_OK; |
1115 } | 1122 } |
1116 | 1123 |
1117 | 1124 |
1118 static void * | 1125 static void * |
1119 ngx_event_create_conf(ngx_cycle_t *cycle) | 1126 ngx_event_core_create_conf(ngx_cycle_t *cycle) |
1120 { | 1127 { |
1121 ngx_event_conf_t *ecf; | 1128 ngx_event_conf_t *ecf; |
1122 | 1129 |
1123 ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t)); | 1130 ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t)); |
1124 if (ecf == NULL) { | 1131 if (ecf == NULL) { |
1145 return ecf; | 1152 return ecf; |
1146 } | 1153 } |
1147 | 1154 |
1148 | 1155 |
1149 static char * | 1156 static char * |
1150 ngx_event_init_conf(ngx_cycle_t *cycle, void *conf) | 1157 ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf) |
1151 { | 1158 { |
1152 ngx_event_conf_t *ecf = conf; | 1159 ngx_event_conf_t *ecf = conf; |
1153 | 1160 |
1154 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) | 1161 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) |
1155 int fd; | 1162 int fd; |