mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 09:42:39 +08:00
nginx-0.1.0-2004-09-29-00:09:22 import
This commit is contained in:
parent
e0eaacd795
commit
55168f6b6b
@ -18,13 +18,15 @@ CORE_DEPS="src/core/nginx.h \
|
||||
src/core/ngx_file.h \
|
||||
src/core/ngx_crc.h \
|
||||
src/core/ngx_rbtree.h \
|
||||
src/core/ngx_radix_tree.h \
|
||||
src/core/ngx_times.h \
|
||||
src/core/ngx_connection.h \
|
||||
src/core/ngx_cycle.h \
|
||||
src/core/ngx_conf_file.h \
|
||||
src/core/ngx_garbage_collector.h"
|
||||
|
||||
# src/core/ngx_radix_tree.h \
|
||||
# src/core/ngx_radix_tree.c \
|
||||
|
||||
CORE_SRCS="src/core/nginx.c \
|
||||
src/core/ngx_log.c \
|
||||
src/core/ngx_palloc.c \
|
||||
@ -37,7 +39,6 @@ CORE_SRCS="src/core/nginx.c \
|
||||
src/core/ngx_inet.c \
|
||||
src/core/ngx_file.c \
|
||||
src/core/ngx_rbtree.c \
|
||||
src/core/ngx_radix_tree.c \
|
||||
src/core/ngx_times.c \
|
||||
src/core/ngx_connection.c \
|
||||
src/core/ngx_cycle.c \
|
||||
|
@ -95,6 +95,8 @@ ngx_module_t ngx_core_module = {
|
||||
|
||||
ngx_uint_t ngx_max_module;
|
||||
|
||||
ngx_uint_t ngx_use_stderr;
|
||||
|
||||
|
||||
int main(int argc, char *const *argv)
|
||||
{
|
||||
@ -116,9 +118,10 @@ int main(int argc, char *const *argv)
|
||||
ngx_regex_init();
|
||||
#endif
|
||||
|
||||
log = ngx_log_init_errlog();
|
||||
ngx_pid = ngx_getpid();
|
||||
|
||||
log = ngx_log_init_errlog();
|
||||
|
||||
#if (NGX_OPENSSL)
|
||||
ngx_ssl_init(log);
|
||||
#endif
|
||||
@ -133,10 +136,6 @@ int main(int argc, char *const *argv)
|
||||
ctx.argc = argc;
|
||||
ctx.argv = argv;
|
||||
|
||||
if (ngx_os_init(log) == NGX_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
|
||||
return 1;
|
||||
}
|
||||
@ -145,6 +144,14 @@ int main(int argc, char *const *argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ngx_use_stderr) {
|
||||
log = ngx_log_init_errlog();
|
||||
}
|
||||
|
||||
if (ngx_os_init(log) == NGX_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ngx_add_inherited_sockets(&init_cycle) == NGX_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
@ -319,6 +326,10 @@ static ngx_int_t ngx_getopt(ngx_master_ctx_t *ctx, ngx_cycle_t *cycle)
|
||||
ngx_test_config = 1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
ngx_use_stderr = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
if (ctx->argv[i + 1] == NULL) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
|
||||
|
@ -259,6 +259,8 @@ void ngx_log_stderr(ngx_event_t *ev)
|
||||
|
||||
ngx_log_t *ngx_log_init_errlog()
|
||||
{
|
||||
ngx_fd_t fd;
|
||||
|
||||
#if (WIN32)
|
||||
|
||||
ngx_stderr.fd = GetStdHandle(STD_ERROR_HANDLE);
|
||||
@ -283,7 +285,37 @@ ngx_log_t *ngx_log_init_errlog()
|
||||
#endif
|
||||
|
||||
ngx_log.file = &ngx_stderr;
|
||||
ngx_log.log_level = NGX_LOG_INFO;
|
||||
ngx_log.log_level = NGX_LOG_ERR;
|
||||
|
||||
#if 0
|
||||
fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
|
||||
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
|
||||
|
||||
if (fd == NGX_INVALID_FILE) {
|
||||
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
|
||||
ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if (WIN32)
|
||||
|
||||
if (ngx_file_append_mode(fd) == NGX_ERROR) {
|
||||
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
|
||||
ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
|
||||
"\" failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (dup2(fd, STDERR_FILENO) == NGX_ERROR) {
|
||||
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
|
||||
"dup2(STDERR) failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return &ngx_log;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user