Klaus Demo nginx / 8035fd2
nginx-0.1.0-2004-10-01-19:53:53 import Igor Sysoev 16 years ago
10 changed file(s) with 61 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
2727 # optimize for Pentium 4, gcc 3.x
2828 CPU_OPT="-march=pentium4"
2929 ;;
30
31 sparc64)
32 # build 64-bit binary, sparcv9 only
33 CPU_OPT="-m64"
34 ;;
35
3630 esac
3731
3832 # STUB for batch builds
66 test -d $PREFIX || mkdir -p $PREFIX
77
88 test -d `dirname $SBIN_PATH` || mkdir -p `dirname $SBIN_PATH`
9 test ! -f $SBIN_PATH || mv $SBIN_PATH $SBIN_PATH.old
910 cp nginx $SBIN_PATH
1011
1112 test -d `dirname $CONF_PATH` || mkdir -p `dirname $CONF_PATH`
3131
3232 *:sun4u)
3333 CFLAGS="$CFLAGS -mcpu=v9"
34
35 if [ ".$CPU" = ".sparc64" ]; then
36 CFLAGS="$CFLAGS -m64"
37 CPU_OPT="-m64"
38 CORE_LINK="$CORE_LINK -m64"
39
40 CC_TEST_FLAGS="$CC_TEST_FLAGS -mcpu=v9 -m64"
41 fi
3442 ;;
3543
3644 *)
117117
118118 ngx_pid = ngx_getpid();
119119
120 if (!(log = ngx_log_init_errlog())) {
120 if (!(log = ngx_log_init_stderr())) {
121121 return 1;
122122 }
123123
141141
142142 if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) {
143143 return 1;
144 }
145
146 if (ngx_test_config) {
147 log->log_level = NGX_LOG_INFO;
148 } else {
149 if (ngx_log_init_error_log() == NGX_ERROR) {
150 return 1;
151 }
144152 }
145153
146154 if (ngx_os_init(log) == NGX_ERROR) {
222222 NGX_FILE_RDWR,
223223 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
224224
225 #if 1
225 #if 0
226226 log->log_level = NGX_LOG_DEBUG_ALL;
227227 #endif
228228 ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
223223 #endif
224224
225225
226
227 ngx_log_t *ngx_log_init_errlog()
228 {
229 ngx_fd_t fd;
230
226 ngx_log_t *ngx_log_init_stderr()
227 {
231228 #if (WIN32)
232229
233230 ngx_stderr.fd = GetStdHandle(STD_ERROR_HANDLE);
252249 #endif
253250
254251 ngx_log.file = &ngx_stderr;
252 ngx_log.log_level = NGX_LOG_ERR;
253
254 return &ngx_log;
255 }
256
257
258 ngx_int_t ngx_log_init_error_log()
259 {
260 ngx_fd_t fd;
255261
256262 #ifdef NGX_ERROR_LOG_PATH
257
258 ngx_log.log_level = NGX_LOG_ERR;
259263
260264 fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
261265 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
263267 if (fd == NGX_INVALID_FILE) {
264268 ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
265269 ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
266 return NULL;
270 return NGX_ERROR;
267271 }
268272
269273 #if (WIN32)
272276 ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
273277 ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
274278 "\" failed");
275 return NULL;
279 return NGX_ERROR;
276280 }
277281
278282 #else
280284 if (dup2(fd, STDERR_FILENO) == NGX_ERROR) {
281285 ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
282286 "dup2(STDERR) failed");
283 return NULL;
284 }
285
286 #endif
287
288 #else
287 return NGX_ERROR;
288 }
289
290 #endif
291
292 #else /* no NGX_ERROR_LOG_PATH */
289293
290294 ngx_log.log_level = NGX_LOG_INFO;
291295
292296 #endif
293297
294 return &ngx_log;
298 return NGX_OK;
295299 }
296300
297301
194194 #define ngx_log_alloc_log(pool, log) ngx_palloc(pool, log, sizeof(ngx_log_t))
195195 #define ngx_log_copy_log(new, old) ngx_memcpy(new, old, sizeof(ngx_log_t))
196196
197 ngx_log_t *ngx_log_init_errlog();
197 ngx_log_t *ngx_log_init_stderr();
198 ngx_int_t ngx_log_init_error_log();
198199 ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
199200 char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log);
200201
918918
919919 ngx_conf_merge_msec_value(conf->connect_timeout,
920920 prev->connect_timeout, 60000);
921 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 30000);
921 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000);
922922
923923 ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0);
924924 ngx_conf_merge_value(conf->set_x_real_ip, prev->set_x_real_ip, 0);
925925 ngx_conf_merge_value(conf->add_x_forwarded_for,
926926 prev->add_x_forwarded_for, 0);
927927
928 ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 30000);
928 ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 60000);
929929
930930 ngx_conf_merge_size_value(conf->header_buffer_size,
931 prev->header_buffer_size, 4096);
932
933 ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, 4096);
931 prev->header_buffer_size, (size_t) ngx_pagesize);
932
933 ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, ngx_pagesize);
934934
935935 if (conf->bufs.num < 2) {
936936 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
13291329 }
13301330
13311331 ngx_conf_merge_size_value(conf->connection_pool_size,
1332 prev->connection_pool_size, 2048);
1332 prev->connection_pool_size, 256);
13331333 ngx_conf_merge_msec_value(conf->post_accept_timeout,
1334 prev->post_accept_timeout, 30000);
1334 prev->post_accept_timeout, 60000);
13351335 ngx_conf_merge_size_value(conf->request_pool_size,
1336 prev->request_pool_size, 16384);
1336 prev->request_pool_size, 4096);
13371337 ngx_conf_merge_msec_value(conf->client_header_timeout,
13381338 prev->client_header_timeout, 60000);
13391339 ngx_conf_merge_size_value(conf->client_header_buffer_size,
14681468 prev->default_type, "text/plain");
14691469
14701470 ngx_conf_merge_size_value(conf->client_max_body_size,
1471 prev->client_max_body_size, 10 * 1024 * 1024);
1471 prev->client_max_body_size, 1 * 1024 * 1024);
14721472 ngx_conf_merge_size_value(conf->client_body_buffer_size,
1473 prev->client_body_buffer_size, 8192);
1473 prev->client_body_buffer_size,
1474 (size_t) 2 * ngx_pagesize);
14741475 ngx_conf_merge_msec_value(conf->client_body_timeout,
14751476 prev->client_body_timeout, 60000);
14761477 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
548548 ngx_err_t err;
549549 ngx_int_t n;
550550 ngx_uint_t i;
551 struct timeval tv;
551552 ngx_listening_t *ls;
552553 ngx_core_conf_t *ccf;
553554 ngx_connection_t *c;
555
556
557 ngx_gettimeofday(&tv);
558
559 ngx_start_msec = (ngx_epoch_msec_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
560 ngx_old_elapsed_msec = 0;
561 ngx_elapsed_msec = 0;
562
554563
555564 ngx_process = NGX_PROCESS_WORKER;
556565