diff options
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/unix/ngx_aio_write_chain.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_freebsd_sendfile_chain.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_sendfile_chain.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_posix_init.c | 9 | ||||
-rw-r--r-- | src/os/unix/ngx_process.c | 6 | ||||
-rw-r--r-- | src/os/unix/ngx_process_cycle.c | 35 | ||||
-rw-r--r-- | src/os/unix/ngx_process_cycle.h | 1 | ||||
-rw-r--r-- | src/os/unix/ngx_solaris_sendfilev_chain.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_writev_chain.c | 4 | ||||
-rw-r--r-- | src/os/win32/ngx_win32_config.h | 9 |
10 files changed, 45 insertions, 35 deletions
diff --git a/src/os/unix/ngx_aio_write_chain.c b/src/os/unix/ngx_aio_write_chain.c index c1109dc12..88b2474c9 100644 --- a/src/os/unix/ngx_aio_write_chain.c +++ b/src/os/unix/ngx_aio_write_chain.c @@ -22,8 +22,8 @@ ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in, /* the maximum limit size is the maximum size_t value - the page size */ - if (limit == 0 || limit > MAX_SIZE_T_VALUE - ngx_pagesize) { - limit = MAX_SIZE_T_VALUE - ngx_pagesize; + if (limit == 0 || limit > NGX_MAX_SIZE_T_VALUE - ngx_pagesize) { + limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; } send = 0; diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c index 187365cb2..521d05082 100644 --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -68,8 +68,8 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, /* the maximum limit size is the maximum size_t value - the page size */ - if (limit == 0 || limit > MAX_SIZE_T_VALUE - ngx_pagesize) { - limit = MAX_SIZE_T_VALUE - ngx_pagesize; + if (limit == 0 || limit > NGX_MAX_SIZE_T_VALUE - ngx_pagesize) { + limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; } send = 0; diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c index c09d03675..99599e231 100644 --- a/src/os/unix/ngx_linux_sendfile_chain.c +++ b/src/os/unix/ngx_linux_sendfile_chain.c @@ -51,8 +51,8 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, /* the maximum limit size is the maximum size_t value - the page size */ - if (limit == 0 || limit > MAX_SIZE_T_VALUE - ngx_pagesize) { - limit = MAX_SIZE_T_VALUE - ngx_pagesize; + if (limit == 0 || limit > NGX_MAX_SIZE_T_VALUE - ngx_pagesize) { + limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; } diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c index 626d821e9..abc7f81f7 100644 --- a/src/os/unix/ngx_posix_init.c +++ b/src/os/unix/ngx_posix_init.c @@ -192,7 +192,7 @@ void ngx_signal_handler(int signo) case ngx_signal_value(NGX_REOPEN_SIGNAL): ngx_reopen = 1; - action = ", reopen logs"; + action = ", reopening logs"; break; case ngx_signal_value(NGX_CHANGEBIN_SIGNAL): @@ -236,6 +236,8 @@ void ngx_signal_handler(int signo) case NGX_PROCESS_WORKER: switch (signo) { + case ngx_signal_value(NGX_NOACCEPT_SIGNAL): + ngx_debug_quit = 1; case ngx_signal_value(NGX_SHUTDOWN_SIGNAL): ngx_quit = 1; action = ", shutting down"; @@ -249,11 +251,10 @@ void ngx_signal_handler(int signo) case ngx_signal_value(NGX_REOPEN_SIGNAL): ngx_reopen = 1; - action = ", reopen logs"; + action = ", reopening logs"; break; case ngx_signal_value(NGX_RECONFIGURE_SIGNAL): - case ngx_signal_value(NGX_NOACCEPT_SIGNAL): case ngx_signal_value(NGX_CHANGEBIN_SIGNAL): case SIGIO: action = ", ignoring"; @@ -263,7 +264,7 @@ void ngx_signal_handler(int signo) break; } - ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0, + ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "signal %d (%s) received%s", signo, sig->signame, action); if (ignore) { diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c index 3141e1403..0825c5f3a 100644 --- a/src/os/unix/ngx_process.c +++ b/src/os/unix/ngx_process.c @@ -142,8 +142,7 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, break; } - ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0, - "spawn %s: %P", name, pid); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start %s %P", name, pid); ngx_processes[s].pid = pid; ngx_processes[s].exited = 0; @@ -216,6 +215,7 @@ void ngx_process_get_status() ngx_int_t i; ngx_uint_t one; struct timeval tv; + one = 0; for ( ;; ) { @@ -287,7 +287,7 @@ void ngx_process_get_status() WCOREDUMP(status) ? " (core dumped)" : ""); } else { - ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0, + ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "%s %P exited with code %d", process, pid, WEXITSTATUS(status)); } diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c index c3b9905b0..d1be6f4ea 100644 --- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -35,6 +35,7 @@ sig_atomic_t ngx_timer; sig_atomic_t ngx_sigio; sig_atomic_t ngx_terminate; sig_atomic_t ngx_quit; +sig_atomic_t ngx_debug_quit; ngx_uint_t ngx_exiting; sig_atomic_t ngx_reconfigure; sig_atomic_t ngx_reopen; @@ -194,8 +195,6 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle) ngx_reconfigure = 0; if (ngx_new_binary) { - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "start new workers"); - ngx_start_worker_processes(cycle, ccf->worker_processes, NGX_PROCESS_RESPAWN); ngx_start_garbage_collector(cycle, NGX_PROCESS_RESPAWN); @@ -204,7 +203,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle) continue; } - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reconfiguring"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring"); cycle = ngx_init_cycle(cycle); if (cycle == NULL) { @@ -233,7 +232,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle) if (ngx_reopen) { ngx_reopen = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopening logs"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs"); ngx_reopen_files(cycle, ccf->user); ngx_signal_worker_processes(cycle, ngx_signal_value(NGX_REOPEN_SIGNAL)); @@ -241,7 +240,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle) if (ngx_change_binary) { ngx_change_binary = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "changing binary"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "changing binary"); ngx_new_binary = ngx_exec_new_binary(cycle, ngx_argv); } @@ -281,7 +280,7 @@ void ngx_single_process_cycle(ngx_cycle_t *cycle) if (ngx_reconfigure) { ngx_reconfigure = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reconfiguring"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reconfiguring"); cycle = ngx_init_cycle(cycle); if (cycle == NULL) { @@ -294,7 +293,7 @@ void ngx_single_process_cycle(ngx_cycle_t *cycle) if (ngx_reopen) { ngx_reopen = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopening logs"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs"); ngx_reopen_files(cycle, (ngx_uid_t) -1); } } @@ -308,7 +307,7 @@ static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, ngx_channel_t ch; struct itimerval itv; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "start worker processes"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start worker processes"); ch.command = NGX_CMD_OPEN_CHANNEL; @@ -367,7 +366,7 @@ static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type) return; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "start garbage collector"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start garbage collector"); ch.command = NGX_CMD_OPEN_CHANNEL; @@ -624,7 +623,7 @@ static void ngx_master_exit(ngx_cycle_t *cycle) { ngx_delete_pidfile(cycle); - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exit"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit"); ngx_destroy_pool(cycle->pool); @@ -690,7 +689,7 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) if (ngx_exiting && ngx_event_timer_rbtree == &ngx_event_timer_sentinel) { - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); #if (NGX_THREADS) @@ -699,6 +698,10 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) ngx_wakeup_worker_threads(cycle); #endif + if (ngx_debug_quit) { + ngx_debug_point(); + } + /* * we do not destroy cycle->pool here because a signal handler * that uses cycle->log can be called at this point @@ -711,7 +714,7 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) ngx_process_events(cycle); if (ngx_terminate) { - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); #if (NGX_THREADS) ngx_wakeup_worker_threads(cycle); @@ -726,7 +729,7 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) if (ngx_quit) { ngx_quit = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "gracefully shutting down"); ngx_setproctitle("worker process is shutting down"); @@ -738,7 +741,7 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) if (ngx_reopen) { ngx_reopen = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs"); ngx_reopen_files(cycle, -1); } } @@ -1096,13 +1099,13 @@ static void ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data) for ( ;; ) { if (ngx_terminate || ngx_quit) { - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting"); exit(0); } if (ngx_reopen) { ngx_reopen = 0; - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs"); + ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "reopening logs"); ngx_reopen_files(cycle, -1); } diff --git a/src/os/unix/ngx_process_cycle.h b/src/os/unix/ngx_process_cycle.h index 16b981f49..7e22da26f 100644 --- a/src/os/unix/ngx_process_cycle.h +++ b/src/os/unix/ngx_process_cycle.h @@ -40,6 +40,7 @@ extern sig_atomic_t ngx_reap; extern sig_atomic_t ngx_timer; extern sig_atomic_t ngx_sigio; extern sig_atomic_t ngx_quit; +extern sig_atomic_t ngx_debug_quit; extern sig_atomic_t ngx_terminate; extern sig_atomic_t ngx_noaccept; extern sig_atomic_t ngx_reconfigure; diff --git a/src/os/unix/ngx_solaris_sendfilev_chain.c b/src/os/unix/ngx_solaris_sendfilev_chain.c index 4c873aa11..c5b812091 100644 --- a/src/os/unix/ngx_solaris_sendfilev_chain.c +++ b/src/os/unix/ngx_solaris_sendfilev_chain.c @@ -62,8 +62,8 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, /* the maximum limit size is the maximum size_t value - the page size */ - if (limit == 0 || limit > MAX_SIZE_T_VALUE - ngx_pagesize) { - limit = MAX_SIZE_T_VALUE - ngx_pagesize; + if (limit == 0 || limit > NGX_MAX_SIZE_T_VALUE - ngx_pagesize) { + limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; } diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c index 8f1087b26..9cbcd864d 100644 --- a/src/os/unix/ngx_writev_chain.c +++ b/src/os/unix/ngx_writev_chain.c @@ -44,8 +44,8 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) /* the maximum limit size is the maximum size_t value - the page size */ - if (limit == 0 || limit > MAX_SIZE_T_VALUE - ngx_pagesize) { - limit = MAX_SIZE_T_VALUE - ngx_pagesize; + if (limit == 0 || limit > NGX_MAX_SIZE_T_VALUE - ngx_pagesize) { + limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; } send = 0; diff --git a/src/os/win32/ngx_win32_config.h b/src/os/win32/ngx_win32_config.h index 79cea3f4f..4d0a221cc 100644 --- a/src/os/win32/ngx_win32_config.h +++ b/src/os/win32/ngx_win32_config.h @@ -114,8 +114,13 @@ typedef int sig_atomic_t; typedef uint32_t ngx_atomic_t; -#define TIME_T_LEN sizeof("-2147483648") - 1 -#define OFF_T_MAX_VALUE 9223372036854775807 +#define NGX_SIZE_T_LEN sizeof("-2147483648") - 1 +#define NGX_TIME_T_LEN sizeof("-2147483648") - 1 +#define NGX_TIME_T_SIZE 4 +#define NGX_OFF_T_LEN sizeof("-9223372036854775807") - 1 +#define NGX_MAX_OFF_T_VALUE 9223372036854775807 +#define NGX_SIG_ATOMIC_T_SIZE 4 + #define NGX_HAVE_LITTLE_ENDIAN 1 #define NGX_THREADS 1 |