comparison src/core/nginx.c @ 249:2a0540287298

nginx-0.0.2-2004-02-03-19:43:54 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 03 Feb 2004 16:43:54 +0000
parents e885208c518b
children c31c40540318
comparison
equal deleted inserted replaced
248:e885208c518b 249:2a0540287298
80 80
81 ngx_int_t ngx_max_module; 81 ngx_int_t ngx_max_module;
82 ngx_uint_t ngx_connection_counter; 82 ngx_uint_t ngx_connection_counter;
83 83
84 ngx_int_t ngx_process; 84 ngx_int_t ngx_process;
85 ngx_pid_t ngx_pid;
85 ngx_pid_t ngx_new_binary; 86 ngx_pid_t ngx_new_binary;
86 87
87 ngx_int_t ngx_inherited; 88 ngx_int_t ngx_inherited;
88 ngx_int_t ngx_reap; 89 ngx_int_t ngx_reap;
89 ngx_int_t ngx_timer; 90 ngx_int_t ngx_timer;
120 #if (HAVE_PCRE) 121 #if (HAVE_PCRE)
121 ngx_regex_init(); 122 ngx_regex_init();
122 #endif 123 #endif
123 124
124 log = ngx_log_init_errlog(); 125 log = ngx_log_init_errlog();
126 ngx_pid = ngx_getpid();
125 127
126 /* init_cycle->log is required for signal handlers */ 128 /* init_cycle->log is required for signal handlers */
127 129
128 ngx_memzero(&init_cycle, sizeof(ngx_cycle_t)); 130 ngx_memzero(&init_cycle, sizeof(ngx_cycle_t));
129 init_cycle.log = log; 131 init_cycle.log = log;
175 177
176 if (!ngx_inherited && ccf->daemon != 0) { 178 if (!ngx_inherited && ccf->daemon != 0) {
177 if (ngx_daemon(cycle->log) == NGX_ERROR) { 179 if (ngx_daemon(cycle->log) == NGX_ERROR) {
178 return 1; 180 return 1;
179 } 181 }
180 }
181
182 if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
183 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
184 "dup2(STDERR) failed");
185 return 1;
186 } 182 }
187 183
188 if (ccf->pid.len == 0) { 184 if (ccf->pid.len == 0) {
189 ccf->pid.len = sizeof(NGINX_PID) - 1; 185 ccf->pid.len = sizeof(NGINX_PID) - 1;
190 ccf->pid.data = NGINX_PID; 186 ccf->pid.data = NGINX_PID;