comparison src/event/ngx_event.c @ 92:19cc647ecd91

nginx-0.0.1-2003-05-20-19:37:55 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 20 May 2003 15:37:55 +0000
parents 637625a2acdb
children 738fe44c70d5
comparison
equal deleted inserted replaced
91:637625a2acdb 92:19cc647ecd91
1 1
2 #include <ngx_config.h> 2 #include <ngx_config.h>
3 #include <ngx_core.h> 3 #include <ngx_core.h>
4 #include <ngx_types.h>
5 #include <ngx_string.h>
6 #include <ngx_log.h>
7 #include <ngx_alloc.h>
8 #include <ngx_array.h>
9 #include <ngx_listen.h> 4 #include <ngx_listen.h>
10 #include <ngx_connection.h> 5 #include <ngx_connection.h>
11 #include <ngx_event.h> 6 #include <ngx_event.h>
12 #include <ngx_conf_file.h> 7
8
9 #define DEF_CONNECTIONS 1024
10
13 11
14 extern ngx_event_module_t ngx_select_module_ctx; 12 extern ngx_event_module_t ngx_select_module_ctx;
15
16 #if (HAVE_POLL)
17 #include <ngx_poll_module.h>
18 #endif
19
20 #if (HAVE_DEVPOLL)
21 #include <ngx_devpoll_module.h>
22 #endif
23 13
24 #if (HAVE_KQUEUE) 14 #if (HAVE_KQUEUE)
25 extern ngx_event_module_t ngx_kqueue_module_ctx; 15 extern ngx_event_module_t ngx_kqueue_module_ctx;
26 #include <ngx_kqueue_module.h> 16 #include <ngx_kqueue_module.h>
17 #endif
18
19 #if (HAVE_DEVPOLL)
20 extern ngx_event_module_t ngx_devpoll_module_ctx;
27 #endif 21 #endif
28 22
29 #if (HAVE_AIO) 23 #if (HAVE_AIO)
30 #include <ngx_aio_module.h> 24 #include <ngx_aio_module.h>
31 #endif 25 #endif
257 { 251 {
258 int m; 252 int m;
259 char *rv; 253 char *rv;
260 void ***ctx; 254 void ***ctx;
261 ngx_conf_t pcf; 255 ngx_conf_t pcf;
262 ngx_event_conf_t *ecf;
263 ngx_event_module_t *module; 256 ngx_event_module_t *module;
264 257
265 /* count the number of the event modules and set up their indices */ 258 /* count the number of the event modules and set up their indices */
266 259
267 ngx_event_max_module = 0; 260 ngx_event_max_module = 0;
362 355
363 ngx_test_null(ecf, ngx_palloc(pool, sizeof(ngx_event_conf_t)), 356 ngx_test_null(ecf, ngx_palloc(pool, sizeof(ngx_event_conf_t)),
364 NGX_CONF_ERROR); 357 NGX_CONF_ERROR);
365 358
366 ecf->connections = NGX_CONF_UNSET; 359 ecf->connections = NGX_CONF_UNSET;
360 ecf->timer_queues = NGX_CONF_UNSET;
367 ecf->type = NGX_CONF_UNSET; 361 ecf->type = NGX_CONF_UNSET;
368 362
369 return ecf; 363 return ecf;
370 } 364 }
371 365
374 { 368 {
375 ngx_event_conf_t *ecf = conf; 369 ngx_event_conf_t *ecf = conf;
376 370
377 #if (HAVE_KQUEUE) 371 #if (HAVE_KQUEUE)
378 372
379 ngx_conf_init_value(ecf->connections, 1024); 373 #if 0
374 if (ecf->connections != NGX_CONF_UNSET) {
375 ecf->connections = (ngx_max_connections < DEF_CONNECTIONS) ?
376 ngx_max_connections : DEF_CONNECTIONS;
377
378 } else if (ecf->connections > ngx_max_connections) {
379 }
380 #endif
381
382 ngx_conf_init_value(ecf->connections, DEF_CONNECTIONS);
380 ngx_conf_init_value(ecf->type, ngx_kqueue_module_ctx.index); 383 ngx_conf_init_value(ecf->type, ngx_kqueue_module_ctx.index);
381 384
385 #elif (HAVE_DEVPOLL)
386
387 ngx_conf_init_value(ecf->connections, DEF_CONNECTIONS);
388 ngx_conf_init_value(ecf->type, ngx_devpoll_module_ctx.index);
389
382 #else /* HAVE_SELECT */ 390 #else /* HAVE_SELECT */
383 391
384 ngx_conf_init_value(ecf->connections, 392 ngx_conf_init_value(ecf->connections,
385 FD_SETSIZE < 1024 ? FD_SETSIZE : 1024); 393 FD_SETSIZE < DEF_CONNECTIONS ? FD_SETSIZE : DEF_CONNECTIONS);
386 394
387 ngx_conf_init_value(ecf->type, ngx_select_module_ctx.index); 395 ngx_conf_init_value(ecf->type, ngx_select_module_ctx.index);
388 396
389 #endif 397 #endif
390 398