comparison src/core/ngx_cycle.c @ 290:87e73f067470

nginx-0.0.2-2004-03-16-10:10:12 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 16 Mar 2004 07:10:12 +0000
parents fc8dc489247e
children a9a9af2c7370
comparison
equal deleted inserted replaced
289:0750faf8d7e3 290:87e73f067470
21 /* STUB */ 21 /* STUB */
22 22
23 23
24 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) 24 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
25 { 25 {
26 ngx_int_t i, n, failed; 26 ngx_uint_t i, n, failed;
27 ngx_log_t *log; 27 ngx_log_t *log;
28 ngx_conf_t conf; 28 ngx_conf_t conf;
29 ngx_pool_t *pool; 29 ngx_pool_t *pool;
30 ngx_cycle_t *cycle, **old; 30 ngx_cycle_t *cycle, **old;
31 ngx_socket_t fd; 31 ngx_socket_t fd;
372 372
373 373
374 void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user) 374 void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
375 { 375 {
376 ngx_fd_t fd; 376 ngx_fd_t fd;
377 ngx_int_t i; 377 ngx_uint_t i;
378 ngx_open_file_t *file; 378 ngx_open_file_t *file;
379 379
380 file = cycle->open_files.elts; 380 file = cycle->open_files.elts;
381 for (i = 0; i < cycle->open_files.nelts; i++) { 381 for (i = 0; i < cycle->open_files.nelts; i++) {
382 if (file[i].name.data == NULL) { 382 if (file[i].name.data == NULL) {
410 410
411 continue; 411 continue;
412 } 412 }
413 #else 413 #else
414 if (user != (ngx_uid_t) -1) { 414 if (user != (ngx_uid_t) -1) {
415 if (chown(file[i].name.data, user, -1) == -1) { 415 if (chown((const char *) file[i].name.data, user, -1) == -1) {
416 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 416 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
417 "chown \"%s\" failed", file[i].name.data); 417 "chown \"%s\" failed", file[i].name.data);
418 418
419 if (ngx_close_file(fd) == NGX_FILE_ERROR) { 419 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
420 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 420 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
459 } 459 }
460 460
461 461
462 static void ngx_clean_old_cycles(ngx_event_t *ev) 462 static void ngx_clean_old_cycles(ngx_event_t *ev)
463 { 463 {
464 int i, n, found, live; 464 ngx_uint_t i, n, found, live;
465 ngx_log_t *log; 465 ngx_log_t *log;
466 ngx_cycle_t **cycle; 466 ngx_cycle_t **cycle;
467 467
468 log = ngx_cycle->log; 468 log = ngx_cycle->log;
469 ngx_temp_pool->log = log; 469 ngx_temp_pool->log = log;
480 } 480 }
481 481
482 found = 0; 482 found = 0;
483 483
484 for (n = 0; n < cycle[i]->connection_n; n++) { 484 for (n = 0; n < cycle[i]->connection_n; n++) {
485 if (cycle[i]->connections[n].fd != -1) { 485 if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) {
486 found = 1; 486 found = 1;
487 487
488 ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n); 488 ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n);
489 489
490 break; 490 break;