comparison src/os/unix/ngx_process_cycle.c @ 332:3a91bfeffaba NGINX_0_6_10

nginx 0.6.10 *) Feature: the "open_file_cache", "open_file_cache_retest", and "open_file_cache_errors" directives. *) Bugfix: socket leak; bug appeared in 0.6.7. *) Bugfix: a charset set by the "charset" directive was not appended to the "Content-Type" header set by $r->send_http_header(). *) Bugfix: a segmentation fault might occur in worker process if /dev/poll method was used.
author Igor Sysoev <http://sysoev.ru>
date Mon, 03 Sep 2007 00:00:00 +0400
parents 390b8f8309d6
children 10cc350ed8a1
comparison
equal deleted inserted replaced
331:b69d5e83bf82 332:3a91bfeffaba
60 60
61 u_long cpu_affinity; 61 u_long cpu_affinity;
62 static u_char master_process[] = "master process"; 62 static u_char master_process[] = "master process";
63 63
64 64
65 static ngx_cycle_t ngx_exit_cycle;
66 static ngx_log_t ngx_exit_log;
67 static ngx_open_file_t ngx_exit_log_file;
68
69
65 void 70 void
66 ngx_master_process_cycle(ngx_cycle_t *cycle) 71 ngx_master_process_cycle(ngx_cycle_t *cycle)
67 { 72 {
68 char *title; 73 char *title;
69 u_char *p; 74 u_char *p;
647 ngx_modules[i]->exit_master(cycle); 652 ngx_modules[i]->exit_master(cycle);
648 } 653 }
649 } 654 }
650 655
651 /* 656 /*
652 * we do not destroy cycle->pool here because a signal handler 657 * Copy ngx_cycle->log related data to the special static exit cycle,
653 * that uses cycle->log can be called at this point 658 * log, and log file structures enough to allow a signal handler to log.
659 * The handler may be called when standard ngx_cycle->log allocated from
660 * ngx_cycle->pool is already destroyed.
654 */ 661 */
655 662
656 #if 0 663 ngx_exit_log_file.fd = ngx_cycle->log->file->fd;
664
665 ngx_exit_log = *ngx_cycle->log;
666 ngx_exit_log.file = &ngx_exit_log_file;
667
668 ngx_exit_cycle.log = &ngx_exit_log;
669 ngx_cycle = &ngx_exit_cycle;
670
657 ngx_destroy_pool(cycle->pool); 671 ngx_destroy_pool(cycle->pool);
658 #endif
659 672
660 exit(0); 673 exit(0);
661 } 674 }
662 675
663 676
994 ngx_debug_point(); 1007 ngx_debug_point();
995 } 1008 }
996 } 1009 }
997 1010
998 /* 1011 /*
999 * we do not destroy cycle->pool here because a signal handler 1012 * Copy ngx_cycle->log related data to the special static exit cycle,
1000 * that uses cycle->log can be called at this point 1013 * log, and log file structures enough to allow a signal handler to log.
1014 * The handler may be called when standard ngx_cycle->log allocated from
1015 * ngx_cycle->pool is already destroyed.
1001 */ 1016 */
1002 1017
1003 #if 0 1018 ngx_exit_log_file.fd = ngx_cycle->log->file->fd;
1019
1020 ngx_exit_log = *ngx_cycle->log;
1021 ngx_exit_log.file = &ngx_exit_log_file;
1022
1023 ngx_exit_cycle.log = &ngx_exit_log;
1024 ngx_cycle = &ngx_exit_cycle;
1025
1004 ngx_destroy_pool(cycle->pool); 1026 ngx_destroy_pool(cycle->pool);
1005 #endif 1027
1028 ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "exit");
1006 1029
1007 exit(0); 1030 exit(0);
1008 } 1031 }
1009 1032
1010 1033