comparison src/event/ngx_event.c @ 154:bb61aa162c6b NGINX_0_3_24

nginx 0.3.24 *) Workaround: for bug in FreeBSD kqueue. *) Bugfix: now a response generated by the "post_action" directive is not transferred to a client. *) Bugfix: the memory leaks were occurring if many log files were used. *) Bugfix: the first "proxy_redirect" directive was working inside one location. *) Bugfix: on 64-bit platforms segmentation fault may occurred on start if the many names were used in the "server_name" directives; bug appeared in 0.3.18.
author Igor Sysoev <http://sysoev.ru>
date Wed, 01 Feb 2006 00:00:00 +0300
parents 82d695e3d662
children 73e8476f9142
comparison
equal deleted inserted replaced
153:c73ae658b822 154:bb61aa162c6b
412 412
413 static ngx_int_t 413 static ngx_int_t
414 ngx_event_module_init(ngx_cycle_t *cycle) 414 ngx_event_module_init(ngx_cycle_t *cycle)
415 { 415 {
416 void ***cf; 416 void ***cf;
417 u_char *shared;
418 size_t size;
417 ngx_event_conf_t *ecf; 419 ngx_event_conf_t *ecf;
418 ngx_core_conf_t *ccf; 420 ngx_core_conf_t *ccf;
421 ngx_shm_t shm;
419 #if !(NGX_WIN32) 422 #if !(NGX_WIN32)
420 char *shared;
421 size_t size;
422 ngx_int_t limit; 423 ngx_int_t limit;
423 struct rlimit rlmt; 424 struct rlimit rlmt;
424 #endif 425 #endif
425 426
426 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module); 427 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module);
459 "open file resource limit: %i", 460 "open file resource limit: %i",
460 ecf->connections, limit); 461 ecf->connections, limit);
461 } 462 }
462 } 463 }
463 464
465 #endif /* !(NGX_WIN32) */
466
464 467
465 if (ccf->master == 0 || ngx_accept_mutex_ptr) { 468 if (ccf->master == 0 || ngx_accept_mutex_ptr) {
466 return NGX_OK; 469 return NGX_OK;
467 } 470 }
468 471
481 + 128 /* ngx_stat_reading */ 484 + 128 /* ngx_stat_reading */
482 + 128; /* ngx_stat_writing */ 485 + 128; /* ngx_stat_writing */
483 486
484 #endif 487 #endif
485 488
486 shared = ngx_create_shared_memory(size, cycle->log); 489 shm.size = size;
487 if (shared == NULL) { 490 shm.log = cycle->log;
491
492 if (ngx_shm_alloc(&shm) != NGX_OK) {
488 return NGX_ERROR; 493 return NGX_ERROR;
489 } 494 }
495
496 shared = shm.addr;
490 497
491 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared; 498 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
492 ngx_connection_counter = (ngx_atomic_t *) (shared + 1 * 128); 499 ngx_connection_counter = (ngx_atomic_t *) (shared + 1 * 128);
493 500
494 #if (NGX_STAT_STUB) 501 #if (NGX_STAT_STUB)
505 *ngx_connection_counter = 1; 512 *ngx_connection_counter = 1;
506 513
507 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 514 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
508 "counter: %p, %d", 515 "counter: %p, %d",
509 ngx_connection_counter, *ngx_connection_counter); 516 ngx_connection_counter, *ngx_connection_counter);
510
511 #endif /* !(NGX_WIN32) */
512 517
513 return NGX_OK; 518 return NGX_OK;
514 } 519 }
515 520
516 521