summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src/os/unix/ngx_process_cycle.c
diff options
context:
space:
mode:
authorrobert <robert@openbsd.org>2014-06-12 15:27:08 +0000
committerrobert <robert@openbsd.org>2014-06-12 15:27:08 +0000
commit48c5ce6cae7e303dfeee3a51091514ba4307bd3d (patch)
tree2c947b91869e053e1c22daedc8be6fc26be784d6 /usr.sbin/nginx/src/os/unix/ngx_process_cycle.c
parentDisable the "switch to insertion sort" optimization to avoid quadratic (diff)
downloadwireguard-openbsd-48c5ce6cae7e303dfeee3a51091514ba4307bd3d.tar.xz
wireguard-openbsd-48c5ce6cae7e303dfeee3a51091514ba4307bd3d.zip
update to 1.6.0 with official syslog support backported from the 1.7 branch
tested by several, ok sthen@
Diffstat (limited to 'usr.sbin/nginx/src/os/unix/ngx_process_cycle.c')
-rw-r--r--usr.sbin/nginx/src/os/unix/ngx_process_cycle.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/usr.sbin/nginx/src/os/unix/ngx_process_cycle.c b/usr.sbin/nginx/src/os/unix/ngx_process_cycle.c
index 77fdcf21fe5..078b1251e90 100644
--- a/usr.sbin/nginx/src/os/unix/ngx_process_cycle.c
+++ b/usr.sbin/nginx/src/os/unix/ngx_process_cycle.c
@@ -356,6 +356,8 @@ ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, ngx_int_t type)
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start worker processes");
+ ngx_memzero(&ch, sizeof(ngx_channel_t));
+
ch.command = NGX_CMD_OPEN_CHANNEL;
for (i = 0; i < n; i++) {
@@ -402,6 +404,8 @@ ngx_start_cache_manager_processes(ngx_cycle_t *cycle, ngx_uint_t respawn)
&ngx_cache_manager_ctx, "cache manager process",
respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN);
+ ngx_memzero(&ch, sizeof(ngx_channel_t));
+
ch.command = NGX_CMD_OPEN_CHANNEL;
ch.pid = ngx_processes[ngx_process_slot].pid;
ch.slot = ngx_process_slot;
@@ -461,6 +465,8 @@ ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
ngx_err_t err;
ngx_channel_t ch;
+ ngx_memzero(&ch, sizeof(ngx_channel_t));
+
#if (NGX_BROKEN_SCM_RIGHTS)
ch.command = 0;
@@ -531,7 +537,7 @@ ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
}
ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
- "kill (%P, %d)" , ngx_processes[i].pid, signo);
+ "kill (%P, %d)", ngx_processes[i].pid, signo);
if (kill(ngx_processes[i].pid, signo) == -1) {
err = ngx_errno;
@@ -562,6 +568,8 @@ ngx_reap_children(ngx_cycle_t *cycle)
ngx_channel_t ch;
ngx_core_conf_t *ccf;
+ ngx_memzero(&ch, sizeof(ngx_channel_t));
+
ch.command = NGX_CMD_CLOSE_CHANNEL;
ch.fd = -1;
@@ -703,10 +711,13 @@ ngx_master_process_exit(ngx_cycle_t *cycle)
* ngx_cycle->pool is already destroyed.
*/
- ngx_exit_log_file.fd = ngx_cycle->log->file->fd;
- ngx_exit_log = *ngx_cycle->log;
+ ngx_exit_log = *ngx_log_get_file_log(ngx_cycle->log);
+
+ ngx_exit_log_file.fd = ngx_exit_log.file->fd;
ngx_exit_log.file = &ngx_exit_log_file;
+ ngx_exit_log.next = NULL;
+ ngx_exit_log.writer = NULL;
ngx_exit_cycle.log = &ngx_exit_log;
ngx_exit_cycle.files = ngx_cycle->files;
@@ -1000,6 +1011,8 @@ nochroot:
"sigprocmask() failed");
}
+ srandom((ngx_pid << 16) ^ ngx_time());
+
/*
* disable deleting previous events for the listening sockets because
* in the worker processes there are no events at all at this point
@@ -1085,8 +1098,8 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
&& !c[i].read->resolver)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
- "open socket #%d left in connection %ui",
- c[i].fd, i);
+ "*%uA open socket #%d left in connection %ui",
+ c[i].number, c[i].fd, i);
ngx_debug_quit = 1;
}
}
@@ -1104,10 +1117,12 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
* ngx_cycle->pool is already destroyed.
*/
- ngx_exit_log_file.fd = ngx_cycle->log->file->fd;
+ ngx_exit_log = *ngx_log_get_file_log(ngx_cycle->log);
- ngx_exit_log = *ngx_cycle->log;
+ ngx_exit_log_file.fd = ngx_exit_log.file->fd;
ngx_exit_log.file = &ngx_exit_log_file;
+ ngx_exit_log.next = NULL;
+ ngx_exit_log.writer = NULL;
ngx_exit_cycle.log = &ngx_exit_log;
ngx_exit_cycle.files = ngx_cycle->files;