diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-11-25 23:44:56 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-11-25 23:44:56 +0300 |
commit | a8fa0a6a37b6e90324e0dcbf4733324199623841 (patch) | |
tree | 1a7edec9aa04946afc22299bf587823488fb492f /src/os | |
parent | d9d0ca12688034d481e2f1f5cf13a098338ec31d (diff) |
nginx-0.0.1-2003-11-25-23:44:56 import
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/unix/ngx_files.h | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_freebsd_config.h | 78 | ||||
-rw-r--r-- | src/os/unix/ngx_freebsd_init.c | 10 | ||||
-rw-r--r-- | src/os/unix/ngx_freebsd_sendfile_chain.c | 8 | ||||
-rw-r--r-- | src/os/unix/ngx_linux.h | 8 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_config.h | 9 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_sendfile_chain.c | 261 | ||||
-rw-r--r-- | src/os/unix/ngx_posix_init.c | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_process.c | 5 | ||||
-rw-r--r-- | src/os/unix/ngx_socket.c | 22 | ||||
-rw-r--r-- | src/os/unix/ngx_socket.h | 12 | ||||
-rw-r--r-- | src/os/unix/ngx_solaris_config.h | 6 | ||||
-rw-r--r-- | src/os/unix/ngx_writev_chain.c | 2 | ||||
-rw-r--r-- | src/os/win32/ngx_sendfile.c | 2 | ||||
-rw-r--r-- | src/os/win32/ngx_win32_config.h | 17 |
15 files changed, 219 insertions, 225 deletions
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index 51cba703a..09fc856a4 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -82,7 +82,7 @@ int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir); #define ngx_read_dir_n "readdir()" -#define ngx_create_dir(name) mkdir(name, (mode_t) 0700) +#define ngx_create_dir(name) mkdir(name, 0700) #define ngx_create_dir_n "mkdir()" diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h index a8014ec60..24fb7b0e8 100644 --- a/src/os/unix/ngx_freebsd_config.h +++ b/src/os/unix/ngx_freebsd_config.h @@ -3,7 +3,7 @@ #include <unistd.h> -#include <stddef.h> /* offsetof */ +#include <stddef.h> /* offsetof() */ #include <stdlib.h> #include <stdarg.h> #include <stdio.h> @@ -27,35 +27,6 @@ #include <osreldate.h> - -/* TODO: autoconf */ -#if (i386) - -#if 0 -#define OFF_FMT "%lld" -#endif - -#define SIZE_FMT "%d" -#define SIZEX_FMT "%x" - -#else /* amd64, alpha, sparc64, ia64 */ - -#if 0 -#define OFF_FMT "%ld" -#endif - -#define SIZE_FMT "%ld" -#define SIZEX_FMT "%lx" - -#endif - -#if 0 -#define TIME_FMT "%ld" -#endif -#define PID_FMT "%d" -#define RLIM_FMT "%lld" - - #ifndef HAVE_SELECT #define HAVE_SELECT 1 #endif @@ -89,58 +60,11 @@ #endif -/* STUB */ -#define HAVE_PREAD 1 -#define HAVE_PWRITE 1 -#define HAVE_LOCALTIME_R 1 - - - /* FreeBSD sendfile */ - -#if __FreeBSD_version >= 300007 - -#ifndef HAVE_FREEBSD_SENDFILE -#define HAVE_FREEBSD_SENDFILE 1 -#endif - -#endif - - -#if (HAVE_FREEBSD_SENDFILE) -#define HAVE_SENDFILE 1 -#endif - - - /* FreeBSD kqueue */ - -#if (__FreeBSD__ == 4 && __FreeBSD_version >= 410000) \ - || __FreeBSD_version >= 500011 - -#ifndef HAVE_KQUEUE -#define HAVE_KQUEUE 1 -#endif - -#endif - #if (HAVE_KQUEUE) #include <sys/event.h> #endif - /* kqueue's NOTE_LOWAT */ - -#if (__FreeBSD__ == 4 && __FreeBSD_version >= 430000) \ - || __FreeBSD_version >= 500018 - -#ifndef HAVE_LOWAT_EVENT -#define HAVE_LOWAT_EVENT 1 -#endif - -#endif - - - - #ifndef HAVE_INHERITED_NONBLOCK #define HAVE_INHERITED_NONBLOCK 1 #endif diff --git a/src/os/unix/ngx_freebsd_init.c b/src/os/unix/ngx_freebsd_init.c index 4f3146d2a..3446382fe 100644 --- a/src/os/unix/ngx_freebsd_init.c +++ b/src/os/unix/ngx_freebsd_init.c @@ -20,12 +20,12 @@ ngx_os_io_t ngx_os_io = { ngx_unix_recv, ngx_readv_chain, NULL, -#if (HAVE_FREEBSD_SENDFILE) +#if (HAVE_SENDFILE) ngx_freebsd_sendfile_chain, - NGX_HAVE_SENDFILE|NGX_HAVE_ZEROCOPY + NGX_HAVE_SENDFILE #else ngx_writev_chain, - NULL + 0 #endif }; @@ -97,7 +97,7 @@ int ngx_os_init(ngx_log_t *log) version, __FreeBSD_version); -#if (HAVE_FREEBSD_SENDFILE) +#if (HAVE_SENDFILE) /* * The determination of the sendfile() nbytes bug is complex enough. @@ -127,7 +127,7 @@ int ngx_os_init(ngx_log_t *log) #endif -#endif /* HAVE_FREEBSD_SENDFILE */ +#endif /* HAVE_SENDFILE */ if ((version < 500000 && version >= 440003) || version >= 500017) { diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c index 610c7d74b..6b0e62efc 100644 --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -22,16 +22,17 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) { - int rc, eintr, eagain; + int rc; char *prev; off_t sent, fprev; size_t hsize, fsize, size; + ngx_int_t eintr, eagain; struct iovec *iov; struct sf_hdtr hdtr; ngx_err_t err; + ngx_hunk_t *file; ngx_array_t header, trailer; ngx_event_t *wev; - ngx_hunk_t *file; ngx_chain_t *cl, *tail; wev = c->write; @@ -53,7 +54,6 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) #endif do { - cl = in; file = NULL; fsize = 0; hsize = 0; @@ -156,7 +156,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) ngx_log_debug(c->log, "NOPUSH"); if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { - ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, ngx_tcp_nopush_n " failed"); return NGX_CHAIN_ERROR; } diff --git a/src/os/unix/ngx_linux.h b/src/os/unix/ngx_linux.h new file mode 100644 index 000000000..12ccb97d4 --- /dev/null +++ b/src/os/unix/ngx_linux.h @@ -0,0 +1,8 @@ +#ifndef _NGX_LINUX_H_INCLUDED_ +#define _NGX_LINUX_H_INCLUDED_ + + +ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) + + +#endif /* _NGX_LINUX_H_INCLUDED_ */ diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h index 22bb7c756..761263f57 100644 --- a/src/os/unix/ngx_linux_config.h +++ b/src/os/unix/ngx_linux_config.h @@ -2,14 +2,14 @@ #define _NGX_LINUX_CONFIG_H_INCLUDED_ -#define _GNU_SOURCE /* pread, pwrite, gethostname, bzero */ +#define _GNU_SOURCE /* pread(), pwrite(), gethostname() */ #define _FILE_OFFSET_BITS 64 #define _LARGEFILE_SOURCE #include <unistd.h> -#include <stddef.h> /* offsetof */ +#include <stddef.h> /* offsetof() */ #include <stdlib.h> #include <stdarg.h> #include <stdio.h> @@ -27,16 +27,17 @@ #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <dirent.h> #include <netdb.h> -#define OFF_FMT "%lld" +#if 0 #define SIZE_FMT "%d" #define SIZEX_FMT "%x" -#define TIME_FMT "%ld" #define PID_FMT "%d" #define RLIM_FMT "%lu" +#endif diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c index 6ea67f46b..31bcf3d6a 100644 --- a/src/os/unix/ngx_linux_sendfile_chain.c +++ b/src/os/unix/ngx_linux_sendfile_chain.c @@ -1,183 +1,214 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_linux_init.h> +#include <ngx_event.h> ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) { - int rc, on, off; + int rc; char *prev; - size_t hsize, size; - ssize_t sent; + off_t fprev; + size_t size, fsize, sent; + ngx_int_t use_cork, eintr; struct iovec *iov; - struct sf_hdtr hdtr; ngx_err_t err; - ngx_array_t header, trailer; ngx_hunk_t *file; - ngx_chain_t *ce; + ngx_array_t header; + ngx_event_t *wev; + ngx_chain_t *cl; - ce = in; - file = NULL; - hsize = 0; + wev = c->write; - on = 1; - off = 0; + if (!wev->ready) { + return in; + } + + cork = 0; + + do { + file = NULL; + fsize = 0; + eintr = 0; - ngx_init_array(header, c->pool, 10, sizeof(struct iovec), NGX_CHAIN_ERROR); - ngx_init_array(trailer, c->pool, 10, sizeof(struct iovec), NGX_CHAIN_ERROR); + ngx_init_array(header, c->pool, 10, sizeof(struct iovec), + NGX_CHAIN_ERROR); - /* create the header iovec */ - if (ngx_hunk_in_memory_only(ce->hunk)) { prev = NULL; iov = NULL; - /* create the iovec and coalesce the neighbouring chain entries */ - while (ce && ngx_hunk_in_memory_only(ce->hunk)) { + /* create the iovec and coalesce the neighbouring hunks */ + + for (cl = in; cl; cl = cl->next) { + if (ngx_hunk_special(cl->hunk)) { + continue; + } + + if (!ngx_hunk_in_memory_only(cl->hunk)) { + break; + } - if (prev == ce->hunk->pos) { - iov->iov_len += ce->hunk->last - ce->hunk->pos; - prev = ce->hunk->last; + if (prev == cl->hunk->pos) { + iov->iov_len += cl->hunk->last - cl->hunk->pos; } else { ngx_test_null(iov, ngx_push_array(&header), NGX_CHAIN_ERROR); - iov->iov_base = ce->hunk->pos; - iov->iov_len = ce->hunk->last - ce->hunk->pos; - prev = ce->hunk->last; + iov->iov_base = cl->hunk->pos; + iov->iov_len = cl->hunk->last - cl->hunk->pos; } - if (ngx_freebsd_sendfile_nbytes_bug) { - hsize += ce->hunk->last - ce->hunk->pos; - } + prev = cl->hunk->last; + } + + /* set TCP_CORK if there is a header before a file */ + + if (!c->tcp_nopush + && header.nelts != 0 + && cl + && cl->hunk->type & NGX_HUNK_FILE) + { + c->tcp_nopush = 1; + +ngx_log_debug(c->log, "CORK"); - ce = ce->next; + if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + ngx_tcp_nopush_n " failed"); + return NGX_CHAIN_ERROR; + } } - } - /* TODO: coalesce the neighbouring file hunks */ - if (ce && (ce->hunk->type & NGX_HUNK_FILE)) { - file = ce->hunk; - ce = ce->next; - } + if (header.nelts == 0 && cl && cl->hunk->type & NGX_HUNK_FILE) { - /* create the trailer iovec */ - if (ce && ngx_hunk_in_memory_only(ce->hunk)) { - prev = NULL; - iov = NULL; + /* get the file hunk */ - /* create the iovec and coalesce the neighbouring chain entries */ - while (ce && ngx_hunk_in_memory_only(ce->hunk)) { + file = cl->hunk; + fsize = (size_t) (file->file_last - file->file_pos); + fprev = file->file_last; + cl = cl->next; - if (prev == ce->hunk->pos) { - iov->iov_len += ce->hunk->last - ce->hunk->pos; - prev = ce->hunk->last; + /* coalesce the neighbouring file hunks */ - } else { - ngx_test_null(iov, ngx_push_array(&trailer), NGX_CHAIN_ERROR); - iov->iov_base = ce->hunk->pos; - iov->iov_len = ce->hunk->last - ce->hunk->pos; - prev = ce->hunk->last; - } + while (cl && (cl->hunk->type & NGX_HUNK_FILE)) { + if (file->file->fd != cl->hunk->file->fd + || fprev != cl->hunk->file_pos) + { + break; + } - ce = ce->next; + fsize += (size_t) (cl->hunk->file_last - cl->hunk->file_pos); + fprev = cl->hunk->file_last; + cl = cl->next; + } } - } - if (file) { - if (setsockopt(c->fd, IPPROTO_TCP, TCP_CORK, - (const void *) &on, sizeof(int)) == -1) { - ngx_log_error(NGX_LOG_CRIT, c->log, err, - "setsockopt(TCP_CORK, 1) failed"); - return NGX_CHAIN_ERROR; - } + /* + * the tail is the rest of the chain that exceeded + * a single sendfile() capability + */ + tail = cl; - rc = sendfile(c->fd, file->file->fd, file->file_pos, - (size_t) (file->file_last - file->file_pos)); + if (fsize) { + rc = sendfile(c->fd, file->file->fd, file->file_pos, fsize); - if (rc == -1) { - err = ngx_errno; - if (err == NGX_EAGAIN) { - ngx_log_error(NGX_LOG_INFO, c->log, err, "senfile() EAGAIN"); + if (rc == -1) { + err = ngx_errno; + if (err == NGX_EAGAIN) { + ngx_log_error(NGX_LOG_INFO, c->log, err, + "sendfile() EAGAIN"); - } else if (err == NGX_EINTR) { - ngx_log_error(NGX_LOG_INFO, c->log, err, "senfile() EINTR"); + } else if (err == NGX_EINTR) { + eintr = 1; + ngx_log_error(NGX_LOG_INFO, c->log, err, + "sendfile() EINTR"); - } else { - ngx_log_error(NGX_LOG_CRIT, c->log, err, "sendfile() failed"); - return NGX_CHAIN_ERROR; + } else { + ngx_log_error(NGX_LOG_CRIT, c->log, err, + "sendfile() failed"); + return NGX_CHAIN_ERROR; + } } - } - sent = rc > 0 ? rc : 0; + sent = rc > 0 ? rc : 0; #if (NGX_DEBUG_WRITE_CHAIN) - ngx_log_debug(c->log, "sendfile: %d, @%qd %d:%d" _ - rc _ file->file_pos _ sent _ - (size_t) (file->file_last - file->file_pos)); + ngx_log_debug(c->log, "sendfile: %d, @" OFF_T_FMT " %d:%d" _ + rc _ file->file_pos _ sent _ fsize); #endif + } else { + rc = writev(c->fd, header.elts, header.nelts); - } else { - rc = writev(c->fd, (struct iovec *) header.elts, header.nelts); - - if (rc == -1) { - err = ngx_errno; - if (err == NGX_EAGAIN) { - ngx_log_error(NGX_LOG_INFO, c->log, err, "writev() EAGAIN"); + if (rc == -1) { + err = ngx_errno; + if (err == NGX_EAGAIN) { + ngx_log_error(NGX_LOG_INFO, c->log, err, "writev() EAGAIN"); - } else if (err == NGX_EINTR) { - ngx_log_error(NGX_LOG_INFO, c->log, err, "writev() EINTR"); + } else if (err == NGX_EINTR) { + eintr = 1; + ngx_log_error(NGX_LOG_INFO, c->log, err, "writev() EINTR"); - } else { - ngx_log_error(NGX_LOG_CRIT, c->log, err, "writev() failed"); - return NGX_CHAIN_ERROR; + } else { + ngx_log_error(NGX_LOG_CRIT, c->log, err, "writev() failed"); + return NGX_CHAIN_ERROR; + } } - } - sent = rc > 0 ? rc : 0; + sent = rc > 0 ? rc : 0; #if (NGX_DEBUG_WRITE_CHAIN) - ngx_log_debug(c->log, "writev: %d" _ sent); + ngx_log_debug(c->log, "writev: %d" _ sent); #endif - } + } - c->sent += sent; + c->sent += sent; - for (ce = in; ce && sent > 0; ce = ce->next) { + for (cl = in; cl; cl = cl->next) { - if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { - size = ce->hunk->last - ce->hunk->pos; - } else { - size = ce->hunk->file_last - ce->hunk->file_pos; - } + if (ngx_hunk_special(cl->hunk)) { + continue; + } - if (sent >= size) { - sent -= size; + if (sent == 0) { + break; + } + + size = ngx_hunk_size(cl->hunk); + + if (sent >= size) { + sent -= size; - if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { - ce->hunk->pos = ce->hunk->last; + if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { + cl->hunk->pos = cl->hunk->last; + } + + if (cl->hunk->type & NGX_HUNK_FILE) { + cl->hunk->file_pos = cl->hunk->file_last; + } + + continue; } - if (ce->hunk->type & NGX_HUNK_FILE) { - ce->hunk->file_pos = ce->hunk->file_last; + if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { + cl->hunk->pos += sent; } - continue; - } + if (cl->hunk->type & NGX_HUNK_FILE) { + cl->hunk->file_pos += sent; + } - if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { - ce->hunk->pos += sent; + break; } - if (ce->hunk->type & NGX_HUNK_FILE) { - ce->hunk->file_pos += sent; - } + in = cl; - break; - } + /* "tail == in" means that a single sendfile() is complete */ - ngx_destroy_array(&trailer); - ngx_destroy_array(&header); + } while ((tail && tail == in) || eintr); + + if (in) { + wev->ready = 0; + } - return ce; + return in; } diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c index 7462dcfc4..7550af0d8 100644 --- a/src/os/unix/ngx_posix_init.c +++ b/src/os/unix/ngx_posix_init.c @@ -56,7 +56,7 @@ int ngx_posix_init(ngx_log_t *log) } ngx_log_error(NGX_LOG_INFO, log, 0, - "getrlimit(RLIMIT_NOFILE): " RLIM_FMT ":" RLIM_FMT, + "getrlimit(RLIMIT_NOFILE): " RLIM_T_FMT ":" RLIM_T_FMT, rlmt.rlim_cur, rlmt.rlim_max); ngx_max_sockets = rlmt.rlim_cur; diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c index e487151ef..04e247589 100644 --- a/src/os/unix/ngx_process.c +++ b/src/os/unix/ngx_process.c @@ -41,9 +41,10 @@ int ngx_spawn_process(ngx_log_t *log) break; default: + break; } -ngx_log_debug(log, "parent process, child: " PID_FMT _ pid); +ngx_log_debug(log, "parent process, child: " PID_T_FMT _ pid); /* book keeping */ @@ -97,7 +98,7 @@ void ngx_sigchld_handler(int signo) one = 1; ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0, - "process " PID_FMT " exited with code %d", pid, status); + "process " PID_T_FMT " exited with code %d", pid, status); /* TODO: restart handler */ diff --git a/src/os/unix/ngx_socket.c b/src/os/unix/ngx_socket.c index 48016cb10..8b34c1c17 100644 --- a/src/os/unix/ngx_socket.c +++ b/src/os/unix/ngx_socket.c @@ -55,6 +55,28 @@ int ngx_tcp_push(ngx_socket_t s) (const void *) &tcp_nopush, sizeof(int)); } +#elif __linux__ + +int ngx_tcp_nopush(ngx_socket_t s) +{ + int cork; + + cork = 1; + + return setsockopt(s, IPPROTO_TCP, TCP_CORK, + (const void *) &cork, sizeof(int)); +} + +int ngx_tcp_push(ngx_socket_t s) +{ + int cork; + + cork = 0; + + return setsockopt(s, IPPROTO_TCP, TCP_CORK, + (const void *) &cork, sizeof(int)); +} + #else 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 2a412d377..4e2eab441 100644 --- a/src/os/unix/ngx_socket.h +++ b/src/os/unix/ngx_socket.h @@ -29,11 +29,19 @@ int ngx_blocking(ngx_socket_t s); #endif int ngx_tcp_nopush(ngx_socket_t s); -#define ngx_tcp_nopush_n "setsockopt(TCP_NOPUSH)" - int ngx_tcp_push(ngx_socket_t s); + +#ifdef __linux__ + +#define ngx_tcp_nopush_n "setsockopt(TCP_CORK)" +#define ngx_tcp_push_n "setsockopt(!TCP_CORK)" + +#else + +#define ngx_tcp_nopush_n "setsockopt(TCP_NOPUSH)" #define ngx_tcp_push_n "setsockopt(!TCP_NOPUSH)" +#endif #define ngx_shutdown_socket shutdown diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h index e592355e1..57ef672e5 100644 --- a/src/os/unix/ngx_solaris_config.h +++ b/src/os/unix/ngx_solaris_config.h @@ -10,7 +10,7 @@ #include <unistd.h> #include <inttypes.h> -#include <stddef.h> /* offsetof */ +#include <stddef.h> /* offsetof() */ #include <stdlib.h> #include <stdarg.h> #include <stdio.h> @@ -28,14 +28,14 @@ #include <netdb.h> -typedef uint32_t u_int32_t; - +#if 0 #define OFF_FMT "%lld" #define SIZE_FMT "%d" #define SIZEX_FMT "%x" #define TIME_FMT "%ld" #define PID_FMT "%ld" #define RLIM_FMT "%lu" +#endif #ifndef HAVE_SELECT diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c index 9b9e62939..85d345c46 100644 --- a/src/os/unix/ngx_writev_chain.c +++ b/src/os/unix/ngx_writev_chain.c @@ -58,7 +58,7 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in) sent = n > 0 ? n : 0; #if (NGX_DEBUG_WRITE_CHAIN) - ngx_log_debug(c->log, "writev: " OFF_FMT _ sent); + ngx_log_debug(c->log, "writev: " OFF_T_FMT _ sent); #endif c->sent += sent; diff --git a/src/os/win32/ngx_sendfile.c b/src/os/win32/ngx_sendfile.c index c2bdf6c62..2dd779d19 100644 --- a/src/os/win32/ngx_sendfile.c +++ b/src/os/win32/ngx_sendfile.c @@ -42,7 +42,7 @@ int ngx_sendfile(ngx_connection_t *c, if (ev->ready) { ev->ready = 0; -#if (HAVE_IOCP_EVENT) /* iocp */ +#if (HAVE_IOCP) /* iocp */ if (ngx_event_flags & NGX_HAVE_IOCP_EVENT) { if (ev->ovlp.error) { diff --git a/src/os/win32/ngx_win32_config.h b/src/os/win32/ngx_win32_config.h index defddab94..7b1fd130b 100644 --- a/src/os/win32/ngx_win32_config.h +++ b/src/os/win32/ngx_win32_config.h @@ -21,7 +21,7 @@ #include <winsock2.h> #include <mswsock.h> -#include <stddef.h> /* offsetof */ +#include <stddef.h> /* offsetof() */ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -41,6 +41,7 @@ #if 0 +/* owc have not __int32 */ typedef unsigned __int32 uint32_t; #else typedef unsigned int uint32_t; @@ -52,18 +53,16 @@ typedef u_int uintptr_t; typedef int ssize_t; typedef long time_t; typedef __int64 off_t; +typedef uint32_t in_addr_t; -#define OFF_FMT "%I64d" -#define SIZE_FMT "%d" -#define SIZEX_FMT "%x" -#define PID_FMT "%d" -#define TIME_FMT "%lu" +#define OFF_T_FMT "%I64d" +#define SIZE_T_FMT "%d" +#define SIZE_T_X_FMT "%x" +#define PID_T_FMT "%d" +#define TIME_T_FMT "%lu" -/* STUB */ -typedef uint32_t u_int32_t; - #ifndef HAVE_INHERITED_NONBLOCK #define HAVE_INHERITED_NONBLOCK 1 |