diff options
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/ngx_files.c | 14 | ||||
-rw-r--r-- | src/os/unix/ngx_files.h | 3 | ||||
-rw-r--r-- | src/os/unix/ngx_process_cycle.c | 18 | ||||
-rw-r--r-- | src/os/unix/ngx_readv_chain.c | 2 |
4 files changed, 16 insertions, 21 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index fbbddc6ab..da452e3fe 100644 --- a/src/os/unix/ngx_files.c +++ b/src/os/unix/ngx_files.c @@ -101,6 +101,20 @@ ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset) } +int ngx_open_tempfile(u_char *name, ngx_uint_t persistent) +{ + ngx_fd_t fd; + + fd = open((const char *) name, O_CREAT|O_EXCL|O_RDWR, 0600); + + if (fd != -1 && !persistent) { + unlink((const char *) name); + } + + return fd; +} + + ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, ngx_pool_t *pool) { diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index 9952a7448..afc5367a3 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -30,8 +30,7 @@ #define ngx_delete_file_n "unlink()" -#define ngx_open_tempfile(name, persistent) \ - open((const char *) name, O_CREAT|O_EXCL|O_RDWR, 0600) +int ngx_open_tempfile(u_char *name, ngx_uint_t persistent); #define ngx_open_tempfile_n "open()" diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c index 090733adb..1ae4deeb6 100644 --- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -65,17 +65,6 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) signo = 0; live = 0; - ngx_accept_mutex_ptr = mmap(NULL, sizeof(ngx_atomic_t), - PROT_READ|PROT_WRITE, - MAP_ANON|MAP_SHARED, -1, 0); - - if (ngx_accept_mutex_ptr == NULL) { - ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, - "mmap(MAP_ANON|MAP_SHARED) failed"); - /* fatal */ - exit(2); - } - for ( ;; ) { ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "new cycle"); @@ -378,11 +367,6 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); - if (ccf->worker_processes > 1) { - ngx_accept_mutex = ngx_accept_mutex_ptr; - ngx_accept_mutex_held = 1; - } - if (ccf->group != (gid_t) NGX_CONF_UNSET) { if (setuid(ccf->group) == -1) { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, @@ -485,8 +469,6 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) ngx_close_listening_sockets(cycle); - ngx_accept_mutex = NULL; - for ( ;; ) { if (ngx_event_timer_rbtree == &ngx_event_timer_sentinel) { ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting"); diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c index 9aee56404..3ec3b2761 100644 --- a/src/os/unix/ngx_readv_chain.c +++ b/src/os/unix/ngx_readv_chain.c @@ -68,7 +68,7 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) } ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, - "readv: %d:%d", io.nelts, iov->iov_len); + "readv: %d, last:%d", io.nelts, iov->iov_len); rev = c->read; |