Klaus Demo nginx / 55168f6
nginx-0.1.0-2004-09-29-00:09:22 import Igor Sysoev 15 years ago
3 changed file(s) with 52 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
1717 src/core/ngx_file.h \
1818 src/core/ngx_crc.h \
1919 src/core/ngx_rbtree.h \
20 src/core/ngx_radix_tree.h \
2120 src/core/ngx_times.h \
2221 src/core/ngx_connection.h \
2322 src/core/ngx_cycle.h \
2423 src/core/ngx_conf_file.h \
2524 src/core/ngx_garbage_collector.h"
25
26 # src/core/ngx_radix_tree.h \
27 # src/core/ngx_radix_tree.c \
2628
2729 CORE_SRCS="src/core/nginx.c \
2830 src/core/ngx_log.c \
3638 src/core/ngx_inet.c \
3739 src/core/ngx_file.c \
3840 src/core/ngx_rbtree.c \
39 src/core/ngx_radix_tree.c \
4041 src/core/ngx_times.c \
4142 src/core/ngx_connection.c \
4243 src/core/ngx_cycle.c \
9494
9595 ngx_uint_t ngx_max_module;
9696
97 ngx_uint_t ngx_use_stderr;
98
9799
98100 int main(int argc, char *const *argv)
99101 {
115117 ngx_regex_init();
116118 #endif
117119
120 ngx_pid = ngx_getpid();
121
118122 log = ngx_log_init_errlog();
119 ngx_pid = ngx_getpid();
120123
121124 #if (NGX_OPENSSL)
122125 ngx_ssl_init(log);
132135 ctx.argc = argc;
133136 ctx.argv = argv;
134137
135 if (ngx_os_init(log) == NGX_ERROR) {
136 return 1;
137 }
138
139138 if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
140139 return 1;
141140 }
142141
143142 if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) {
143 return 1;
144 }
145
146 if (ngx_use_stderr) {
147 log = ngx_log_init_errlog();
148 }
149
150 if (ngx_os_init(log) == NGX_ERROR) {
144151 return 1;
145152 }
146153
316323
317324 case 't':
318325 ngx_test_config = 1;
326 break;
327
328 case 's':
329 ngx_use_stderr = 1;
319330 break;
320331
321332 case 'c':
258258
259259 ngx_log_t *ngx_log_init_errlog()
260260 {
261 ngx_fd_t fd;
262
261263 #if (WIN32)
262264
263265 ngx_stderr.fd = GetStdHandle(STD_ERROR_HANDLE);
282284 #endif
283285
284286 ngx_log.file = &ngx_stderr;
285 ngx_log.log_level = NGX_LOG_INFO;
287 ngx_log.log_level = NGX_LOG_ERR;
288
289 #if 0
290 fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
291 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
292
293 if (fd == NGX_INVALID_FILE) {
294 ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
295 ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
296 return NULL;
297 }
298
299 #if (WIN32)
300
301 if (ngx_file_append_mode(fd) == NGX_ERROR) {
302 ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
303 ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
304 "\" failed");
305 return NULL;
306 }
307
308 #else
309
310 if (dup2(fd, STDERR_FILENO) == NGX_ERROR) {
311 ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
312 "dup2(STDERR) failed");
313 return NULL;
314 }
315
316 #endif
317 #endif
286318
287319 return &ngx_log;
288320 }