diff options
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/ngx_files.c | 56 | ||||
-rw-r--r-- | src/os/unix/ngx_files.h | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_freebsd_config.h | 5 | ||||
-rw-r--r-- | src/os/unix/ngx_freebsd_sendfile_chain.c | 28 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_config.h | 8 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_sendfile_chain.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_os.h | 8 | ||||
-rw-r--r-- | src/os/unix/ngx_posix_config.h | 53 | ||||
-rw-r--r-- | src/os/unix/ngx_posix_init.c | 6 | ||||
-rw-r--r-- | src/os/unix/ngx_process.c | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_process.h | 6 | ||||
-rw-r--r-- | src/os/unix/ngx_process_cycle.c | 17 | ||||
-rw-r--r-- | src/os/unix/ngx_readv_chain.c | 6 | ||||
-rw-r--r-- | src/os/unix/ngx_recv.c | 6 | ||||
-rw-r--r-- | src/os/unix/ngx_send.c | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_setproctitle.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_socket.c | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_socket.h | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_solaris_config.h | 4 | ||||
-rw-r--r-- | src/os/unix/ngx_thread.h | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_time.h | 8 | ||||
-rw-r--r-- | src/os/unix/ngx_writev_chain.c | 2 |
22 files changed, 129 insertions, 106 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index 8603ab2d9..f2ba3a451 100644 --- a/src/os/unix/ngx_files.c +++ b/src/os/unix/ngx_files.c @@ -210,59 +210,3 @@ int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir) return NGX_OK; } - - -#if 0 - -ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset) -{ - if (!file->read->ready) { - - ngx_memzero(&file->iocb, sizeof(iocb)); - file->iocb.aio_fildes = file->fd; - file->iocb.aio_buf = buf; - file->iocb.aio_nbytes = size; - file->iocb.aio_offset = offset; -#if (USE_AIO_KQUEUE) - file->iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT; - file->iocb.aio_sigevent.sigev_notify_kqueue = tid->kq; - file->iocb.aio_sigevent.sigev_value = (union sigval) file; -#endif -#if (USE_AIO_SIGNAL) - file->iocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - file->iocb.aio_sigevent.sigev_signo = NGX_SIGAIO; -#ifndef __FreeBSD__ - file->iocb.aio_sigevent.sigev_value.sival_ptr = file; -#endif -#endif - - if (aio_read(&file->iocb) == -1) { - ngx_log_error(NGX_LOG_ERR, file->log, ngx_errno, - "aio_read() failed"); - return NGX_ERROR; - - n = aio_error(&file->iocb); - if (n == EINPROGRESS) - return NGX_AGAIN; - - if (n == -1) { - ngx_log_error(NGX_LOG_ERR, file->log, ngx_errno, - "aio_read() failed"); - return NGX_ERROR; - } - } - - ngx_assert(file->iocb.aio_buf == buf), return NGX_ERROR, - "ngx_aio_read_file: another buffer is passed"); - - n = aio_return(&file->iocb); - if (n == -1) { - ngx_log_error(NGX_LOG_ERR, file->log, ngx_errno, - "aio_read() failed"); - return NGX_ERROR; - } - - return n; -} - -#endif diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index 3ba167004..06c22f5d3 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -99,7 +99,7 @@ int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir); #define ngx_de_name(dir) (dir)->de->d_name -#ifdef __FreeBSD__ +#if (NGX_FREEBSD) #define ngx_de_namelen(dir) (dir)->de->d_namlen #else #define ngx_de_namelen(dir) ngx_strlen((dir)->de->d_name) diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h index 7961a3b6e..4840a9970 100644 --- a/src/os/unix/ngx_freebsd_config.h +++ b/src/os/unix/ngx_freebsd_config.h @@ -22,8 +22,8 @@ #include <grp.h> #include <dirent.h> -#include <sys/uio.h> #include <sys/filio.h> /* FIONBIO */ +#include <sys/uio.h> #include <sys/stat.h> #include <fcntl.h> @@ -41,12 +41,11 @@ #include <libutil.h> /* setproctitle() before 4.1 */ #include <osreldate.h> #include <sys/sysctl.h> +#include <sys/param.h> /* ALIGN() */ #if __FreeBSD_version < 400017 -#include <sys/param.h> /* ALIGN() */ - /* FreeBSD 3.x has no CMSG_SPACE() at all and has the broken CMSG_DATA() */ #undef CMSG_SPACE diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c index d29debfbc..8303c0631 100644 --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -57,7 +57,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, #if (HAVE_KQUEUE) - if ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) && wev->pending_eof) { + if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno, "kevent() reported about an closed connection"); @@ -131,7 +131,6 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, send += size; } - /* get the file buf */ if (cl && cl->buf->in_file && send < limit) { file = cl->buf; @@ -164,17 +163,18 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, && fprev == cl->buf->file_pos); } + if (file) { + /* create the tailer iovec and coalesce the neighbouring bufs */ prev = NULL; iov = NULL; - for (/* void */; - cl && header.nelts < IOV_MAX && send < limit; - cl = cl->next) - { + while (cl && header.nelts < IOV_MAX && send < limit) { + if (ngx_buf_special(cl->buf)) { + cl = cl->next; continue; } @@ -202,6 +202,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, prev = cl->buf->pos + size; send += size; + cl = cl->next; } } @@ -210,7 +211,6 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, if (ngx_freebsd_use_tcp_nopush && c->tcp_nopush == NGX_TCP_NOPUSH_UNSET) { - if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { err = ngx_errno; @@ -275,6 +275,20 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, } } + if (rc == 0 && sent == 0) { + + /* + * rc and sent are equals to zero when someone has truncated + * the file, so the offset became beyond the end of the file + */ + + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "sendfile() reported that \"%s\" was truncated", + file->file->name.data); + + return NGX_CHAIN_ERROR; + } + ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, "sendfile: %d, @" OFF_T_FMT " " OFF_T_FMT ":%d", rc, file->file_pos, sent, fsize + hsize); diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h index 11427d329..9a0fee9ba 100644 --- a/src/os/unix/ngx_linux_config.h +++ b/src/os/unix/ngx_linux_config.h @@ -8,11 +8,11 @@ #define _NGX_LINUX_CONFIG_H_INCLUDED_ +#ifndef _GNU_SOURCE #define _GNU_SOURCE /* pread(), pwrite(), gethostname() */ +#endif #define _FILE_OFFSET_BITS 64 -#define _LARGEFILE_SOURCE - #include <sys/types.h> #include <sys/time.h> @@ -51,11 +51,11 @@ #include <ngx_auto_config.h> -#if (HAVE_PRCTL) +#if (NGX_HAVE_SYS_PRCTL_H) #include <sys/prctl.h> #endif -#if (HAVE_SENDFILE64) +#if (NGX_HAVE_SENDFILE64) #include <sys/sendfile.h> #else extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size); diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c index 38a2a96d2..4de7ac2cd 100644 --- a/src/os/unix/ngx_linux_sendfile_chain.c +++ b/src/os/unix/ngx_linux_sendfile_chain.c @@ -37,7 +37,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, ngx_event_t *wev; ngx_chain_t *cl; struct iovec *iov, headers[NGX_HEADERS]; -#if (HAVE_SENDFILE64) +#if (NGX_HAVE_SENDFILE64) off_t offset; #else int32_t offset; @@ -167,7 +167,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, } if (file) { -#if (HAVE_SENDFILE64) +#if (NGX_HAVE_SENDFILE64) offset = file->file_pos; #else offset = (int32_t) file->file_pos; diff --git a/src/os/unix/ngx_os.h b/src/os/unix/ngx_os.h index b28a73ffb..dc9f7a803 100644 --- a/src/os/unix/ngx_os.h +++ b/src/os/unix/ngx_os.h @@ -66,17 +66,15 @@ extern ngx_int_t ngx_inherited_nonblocking; #define ngx_stderr_fileno STDERR_FILENO -#ifdef __FreeBSD__ +#if (NGX_FREEBSD) #include <ngx_freebsd.h> -#endif -#ifdef __linux__ +#elif (NGX_LINUX) #include <ngx_linux.h> -#endif -#ifdef SOLARIS +#elif (NGX_SOLARIS) #include <ngx_solaris.h> #endif diff --git a/src/os/unix/ngx_posix_config.h b/src/os/unix/ngx_posix_config.h index bf0f5d842..bac02f7dd 100644 --- a/src/os/unix/ngx_posix_config.h +++ b/src/os/unix/ngx_posix_config.h @@ -8,9 +8,20 @@ #define _NGX_POSIX_CONFIG_H_INCLUDED_ +#if 0 +#define _XOPEN_SOURCE +#define _XOPEN_SOURCE_EXTENDED 1 +#endif + + #include <sys/types.h> #include <sys/time.h> +#if (NGX_HAVE_UNISTD_H) #include <unistd.h> +#endif +#if (NGX_HAVE_INTTYPES_H) +#include <inttypes.h> +#endif #include <stdarg.h> #include <stddef.h> /* offsetof() */ #include <stdio.h> @@ -22,8 +33,12 @@ #include <grp.h> #include <dirent.h> -#include <sys/uio.h> +#if (NGX_HAVE_SYS_FILIO_H) #include <sys/filio.h> /* FIONBIO */ +#endif +#include <sys/ioctl.h> /* FIONBIO */ + +#include <sys/uio.h> #include <sys/stat.h> #include <fcntl.h> @@ -34,9 +49,19 @@ #include <sys/socket.h> #include <netinet/in.h> +#include <netinet/tcp.h> /* TCP_NODELAY */ #include <arpa/inet.h> #include <netdb.h> +#if (NGX_HAVE_LIMITS_H) +#include <limits.h> /* IOV_MAX */ +#endif + +#ifndef IOV_MAX +#define IOV_MAX 16 +#endif + + #include <ngx_auto_config.h> @@ -53,6 +78,32 @@ #endif +#if (HAVE_KQUEUE) +#include <sys/event.h> +#endif + + +#if (HAVE_DEVPOLL) +#include <sys/ioctl.h> +#include <sys/devpoll.h> +#endif + + +#if (__FreeBSD__) && (__FreeBSD_version < 400017) + +#include <sys/param.h> /* ALIGN() */ + +/* FreeBSD 3.x has no CMSG_SPACE() at all and has the broken CMSG_DATA() */ + +#undef CMSG_SPACE +#define CMSG_SPACE(l) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(l)) + +#undef CMSG_DATA +#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + ALIGN(sizeof(struct cmsghdr))) + +#endif + + #define ngx_setproctitle(title) diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c index 134c27691..1c7b1b6c0 100644 --- a/src/os/unix/ngx_posix_init.c +++ b/src/os/unix/ngx_posix_init.c @@ -33,6 +33,12 @@ int ngx_os_init(ngx_log_t *log) } +void ngx_os_status(ngx_log_t *log) +{ + ngx_posix_status(log); +} + + #endif diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c index aff242c19..4f7ed6409 100644 --- a/src/os/unix/ngx_process.c +++ b/src/os/unix/ngx_process.c @@ -236,7 +236,7 @@ void ngx_process_get_status() return; } -#if (SOLARIS) +#if (NGX_SOLARIS) /* * Solaris always calls the signal handler for each exited process diff --git a/src/os/unix/ngx_process.h b/src/os/unix/ngx_process.h index 0cea30210..9cb0700d6 100644 --- a/src/os/unix/ngx_process.h +++ b/src/os/unix/ngx_process.h @@ -54,7 +54,13 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx); void ngx_process_get_status(void); + +#if (NGX_HAVE_SCHED_YIELD) #define ngx_sched_yield() sched_yield() +#else +#define ngx_sched_yield() usleep(1) +#endif + extern int ngx_argc; extern char **ngx_argv; diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c index c43a7eb00..1da491526 100644 --- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -175,11 +175,14 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle) if (ngx_timer) { ngx_timer = 0; - ngx_start_worker_processes(cycle, ccf->worker_processes, - NGX_PROCESS_JUST_RESPAWN); - live = 1; - ngx_signal_worker_processes(cycle, + + if (!ngx_noaccepting) { + ngx_start_worker_processes(cycle, ccf->worker_processes, + NGX_PROCESS_JUST_RESPAWN); + live = 1; + ngx_signal_worker_processes(cycle, ngx_signal_value(NGX_SHUTDOWN_SIGNAL)); + } } if (ngx_reconfigure) { @@ -578,16 +581,14 @@ 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->group != (gid_t) NGX_CONF_UNSET) { + if (geteuid() == 0) { if (setgid(ccf->group) == -1) { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, "setgid(%d) failed", ccf->group); /* fatal */ exit(2); } - } - if (ccf->user != (uid_t) NGX_CONF_UNSET) { if (setuid(ccf->user) == -1) { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, "setuid(%d) failed", ccf->user); @@ -596,7 +597,7 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data) } } -#if (HAVE_PR_SET_DUMPABLE) +#if (NGX_HAVE_PR_SET_DUMPABLE) /* allow coredump after setuid() in Linux 2.4.x */ diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c index a529b3d3f..2db998a86 100644 --- a/src/os/unix/ngx_readv_chain.c +++ b/src/os/unix/ngx_readv_chain.c @@ -22,7 +22,7 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) rev = c->read; - if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, "readv: eof:%d, avail:%d, err:%d", rev->pending_eof, rev->available, rev->kq_errno); @@ -81,7 +81,7 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) n = readv(c->fd, (struct iovec *) io.elts, io.nelts); if (n >= 0) { - if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { rev->available -= n; /* @@ -186,7 +186,7 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) } else if (n > 0) { - if (n < size && !(ngx_event_flags & NGX_HAVE_GREEDY_EVENT)) { + if (n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) { rev->ready = 0; } diff --git a/src/os/unix/ngx_recv.c b/src/os/unix/ngx_recv.c index 6e5b8c06d..d58ca9e3d 100644 --- a/src/os/unix/ngx_recv.c +++ b/src/os/unix/ngx_recv.c @@ -19,7 +19,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) rev = c->read; - if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, "recv: eof:%d, avail:%d, err:%d", rev->pending_eof, rev->available, rev->kq_errno); @@ -60,7 +60,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) "recv: fd:%d %d of %d", c->fd, n, size); if (n >= 0) { - if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { rev->available -= n; /* @@ -139,7 +139,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) } else if (n > 0) { if ((size_t) n < size - && !(ngx_event_flags & NGX_HAVE_GREEDY_EVENT)) + && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) { rev->ready = 0; } diff --git a/src/os/unix/ngx_send.c b/src/os/unix/ngx_send.c index f09dadb50..ff501c30a 100644 --- a/src/os/unix/ngx_send.c +++ b/src/os/unix/ngx_send.c @@ -19,7 +19,7 @@ ssize_t ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size) #if (HAVE_KQUEUE) - if ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) && wev->pending_eof) { + if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno, "kevent() reported about an closed connection"); diff --git a/src/os/unix/ngx_setproctitle.c b/src/os/unix/ngx_setproctitle.c index 6ac87077f..2e41108b5 100644 --- a/src/os/unix/ngx_setproctitle.c +++ b/src/os/unix/ngx_setproctitle.c @@ -76,7 +76,7 @@ void ngx_setproctitle(char *title) { u_char *p; -#if (SOLARIS) +#if (NGX_SOLARIS) ngx_int_t i; size_t size; @@ -90,7 +90,7 @@ void ngx_setproctitle(char *title) p = ngx_cpystrn(p, (u_char *) title, ngx_os_argv_last - (char *) p); -#if (SOLARIS) +#if (NGX_SOLARIS) size = 0; diff --git a/src/os/unix/ngx_socket.c b/src/os/unix/ngx_socket.c index 3e188bde6..da936b2fb 100644 --- a/src/os/unix/ngx_socket.c +++ b/src/os/unix/ngx_socket.c @@ -44,7 +44,7 @@ int ngx_blocking(ngx_socket_t s) #endif -#ifdef __FreeBSD__ +#if (NGX_FREEBSD) int ngx_tcp_nopush(ngx_socket_t s) { @@ -67,7 +67,7 @@ int ngx_tcp_push(ngx_socket_t s) (const void *) &tcp_nopush, sizeof(int)); } -#elif __linux__ +#elif (NGX_LINUX) int ngx_tcp_nopush(ngx_socket_t s) { diff --git a/src/os/unix/ngx_socket.h b/src/os/unix/ngx_socket.h index 67d0d41de..34449d090 100644 --- a/src/os/unix/ngx_socket.h +++ b/src/os/unix/ngx_socket.h @@ -37,7 +37,7 @@ int ngx_blocking(ngx_socket_t s); int ngx_tcp_nopush(ngx_socket_t s); int ngx_tcp_push(ngx_socket_t s); -#ifdef __linux__ +#if (NGX_LINUX) #define ngx_tcp_nopush_n "setsockopt(TCP_CORK)" #define ngx_tcp_push_n "setsockopt(!TCP_CORK)" diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h index 96c119cab..5d94cdc98 100644 --- a/src/os/unix/ngx_solaris_config.h +++ b/src/os/unix/ngx_solaris_config.h @@ -8,8 +8,6 @@ #define _NGX_SOLARIS_CONFIG_H_INCLUDED_ -#define SOLARIS 1 - #define _REENTRANT #define _FILE_OFFSET_BITS 64 /* must be before <sys/types.h> */ @@ -28,8 +26,8 @@ #include <grp.h> #include <dirent.h> -#include <sys/uio.h> #include <sys/filio.h> /* FIONBIO */ +#include <sys/uio.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/src/os/unix/ngx_thread.h b/src/os/unix/ngx_thread.h index 7b5dc239c..16e216ef0 100644 --- a/src/os/unix/ngx_thread.h +++ b/src/os/unix/ngx_thread.h @@ -28,7 +28,7 @@ typedef pthread_t ngx_tid_t; #define ngx_thread_self() pthread_self() #define ngx_log_tid (int) ngx_thread_self() -#if defined(__FreeBSD__) && !defined(NGX_LINUXTHREADS) +#if (NGX_FREEBSD) && !(NGX_LINUXTHREADS) #define TID_T_FMT PTR_FMT #else #define TID_T_FMT "%d" diff --git a/src/os/unix/ngx_time.h b/src/os/unix/ngx_time.h index 793e32e7c..0ead0d837 100644 --- a/src/os/unix/ngx_time.h +++ b/src/os/unix/ngx_time.h @@ -42,8 +42,14 @@ typedef struct tm ngx_tm_t; #endif -#if (SOLARIS) +#if (NGX_SOLARIS) + #define ngx_timezone(isdst) (- (isdst ? altzone : timezone) / 60) + +#else + +#define ngx_timezone(isdst) (- (isdst ? timezone + 3600 : timezone) / 60) + #endif diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c index a3595ff0c..e57b59305 100644 --- a/src/os/unix/ngx_writev_chain.c +++ b/src/os/unix/ngx_writev_chain.c @@ -32,7 +32,7 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) #if (HAVE_KQUEUE) - if ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) && wev->pending_eof) { + if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno, "kevent() reported about an closed connection"); |