Mercurial > hg > nginx
comparison src/os/unix/ngx_process_cycle.c @ 303:00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 01 Apr 2004 16:20:53 +0000 |
parents | 1526e7686b20 |
children | 4b1a3a4acc60 |
comparison
equal
deleted
inserted
replaced
302:1526e7686b20 | 303:00c5660d2707 |
---|---|
62 | 62 |
63 ngx_new_binary = 0; | 63 ngx_new_binary = 0; |
64 delay = 0; | 64 delay = 0; |
65 signo = 0; | 65 signo = 0; |
66 live = 0; | 66 live = 0; |
67 | |
68 ngx_accept_mutex_ptr = mmap(NULL, sizeof(ngx_atomic_t), | |
69 PROT_READ|PROT_WRITE, | |
70 MAP_ANON|MAP_SHARED, -1, 0); | |
71 | |
72 if (ngx_accept_mutex_ptr == NULL) { | |
73 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | |
74 "mmap(MAP_ANON|MAP_SHARED) failed"); | |
75 /* fatal */ | |
76 exit(2); | |
77 } | |
78 | 67 |
79 for ( ;; ) { | 68 for ( ;; ) { |
80 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "new cycle"); | 69 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "new cycle"); |
81 | 70 |
82 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, | 71 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, |
376 ngx_process = NGX_PROCESS_WORKER; | 365 ngx_process = NGX_PROCESS_WORKER; |
377 ngx_last_process = 0; | 366 ngx_last_process = 0; |
378 | 367 |
379 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); | 368 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
380 | 369 |
381 if (ccf->worker_processes > 1) { | |
382 ngx_accept_mutex = ngx_accept_mutex_ptr; | |
383 ngx_accept_mutex_held = 1; | |
384 } | |
385 | |
386 if (ccf->group != (gid_t) NGX_CONF_UNSET) { | 370 if (ccf->group != (gid_t) NGX_CONF_UNSET) { |
387 if (setuid(ccf->group) == -1) { | 371 if (setuid(ccf->group) == -1) { |
388 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 372 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
389 "setgid(%d) failed", ccf->group); | 373 "setgid(%d) failed", ccf->group); |
390 /* fatal */ | 374 /* fatal */ |
483 } | 467 } |
484 } | 468 } |
485 | 469 |
486 ngx_close_listening_sockets(cycle); | 470 ngx_close_listening_sockets(cycle); |
487 | 471 |
488 ngx_accept_mutex = NULL; | |
489 | |
490 for ( ;; ) { | 472 for ( ;; ) { |
491 if (ngx_event_timer_rbtree == &ngx_event_timer_sentinel) { | 473 if (ngx_event_timer_rbtree == &ngx_event_timer_sentinel) { |
492 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); | 474 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); |
493 exit(0); | 475 exit(0); |
494 } | 476 } |