Mercurial > hg > nginx
changeset 94:8220378432a8
nginx-0.0.1-2003-05-22-19:23:47 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 22 May 2003 15:23:47 +0000 |
parents | 738fe44c70d5 |
children | b48066122884 |
files | src/core/ngx_config.h src/core/ngx_connection.h src/event/modules/ngx_aio_module.c src/event/ngx_event.h src/http/ngx_http_core_module.c src/http/ngx_http_event.c src/http/ngx_http_output_filter.c src/os/unix/ngx_freebsd_config.h src/os/unix/ngx_freebsd_init.c src/os/unix/ngx_freebsd_sendfile_chain.c src/os/unix/ngx_freebsd_write_chain.c src/os/unix/ngx_linux_config.h src/os/unix/ngx_solaris_config.h src/os/unix/ngx_writev_chain.c |
diffstat | 14 files changed, 337 insertions(+), 246 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_config.h Wed May 21 13:28:21 2003 +0000 +++ b/src/core/ngx_config.h Thu May 22 15:23:47 2003 +0000 @@ -50,6 +50,10 @@ #endif +#ifndef INFTIM /* Linux */ +#define INFTIM -1 +#endif + #ifndef INADDR_NONE /* Solaris */ #define INADDR_NONE ((unsigned long) -1) #endif
--- a/src/core/ngx_connection.h Wed May 21 13:28:21 2003 +0000 +++ b/src/core/ngx_connection.h Thu May 22 15:23:47 2003 +0000 @@ -114,7 +114,7 @@ /* TODO: move it to OS specific file */ #if (__FreeBSD__) -ngx_chain_t *ngx_freebsd_write_chain(ngx_connection_t *c, ngx_chain_t *in); +ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in); ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in); #endif
--- a/src/event/modules/ngx_aio_module.c Wed May 21 13:28:21 2003 +0000 +++ b/src/event/modules/ngx_aio_module.c Thu May 22 15:23:47 2003 +0000 @@ -13,6 +13,7 @@ static void ngx_aio_done(ngx_log_t *log); static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags); static int ngx_aio_del_event(ngx_event_t *ev, int event, u_int flags); +static int ngx_aio_del_connection(ngx_connection_t *c); static int ngx_aio_process_events(ngx_log_t *log); @@ -39,7 +40,7 @@ NULL, /* enable an event */ NULL, /* disable an event */ NULL, /* add an connection */ - NULL, /* delete an connection */ + ngx_aio_del_connection, /* delete an connection */ ngx_aio_process_events, /* process the events */ ngx_aio_init, /* init the events */ ngx_aio_done /* done the events */ @@ -94,6 +95,58 @@ } +static int ngx_aio_del_connection(ngx_connection_t *c) +{ + int rc; + + if (c->read->active || c->write->active) { + rc = aio_cancel(c->fd, NULL); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_cancel() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_cancel: %d" _ rc); + +#if 0 + rc = aio_error(&c->read->aiocb); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_error() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_error: %d" _ rc); +#endif + } + +#if 0 + if (c->write->active) { + rc = aio_cancel(c->fd, &c->write->aiocb); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_cancel() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_cancel: %d" _ rc); + + rc = aio_error(&c->read->aiocb); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_error() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_error: %d" _ rc); + } +#endif + + return NGX_OK; +} + + static int ngx_aio_process_events(ngx_log_t *log) { return ngx_kqueue_module_ctx.actions.process(log);
--- a/src/event/ngx_event.h Wed May 21 13:28:21 2003 +0000 +++ b/src/event/ngx_event.h Thu May 22 15:23:47 2003 +0000 @@ -280,6 +280,7 @@ #define ngx_process_events ngx_event_actions.process #define ngx_add_event ngx_event_actions.add #define ngx_del_event ngx_event_actions.del +#define ngx_del_conn ngx_event_actions.del_conn #if 0 #define ngx_add_timer ngx_event_actions.timer
--- a/src/http/ngx_http_core_module.c Wed May 21 13:28:21 2003 +0000 +++ b/src/http/ngx_http_core_module.c Thu May 22 15:23:47 2003 +0000 @@ -319,7 +319,7 @@ lcf = (ngx_http_core_loc_conf_t *) ngx_http_get_module_loc_conf(r, ngx_http_core_module_ctx); - if (lcf->sendfile == 0) { + if ((ngx_io.flags & NGX_IO_SENDFILE) == 0 || lcf->sendfile == 0) { r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY; }
--- a/src/http/ngx_http_event.c Wed May 21 13:28:21 2003 +0000 +++ b/src/http/ngx_http_event.c Thu May 22 15:23:47 2003 +0000 @@ -33,6 +33,7 @@ static void ngx_http_keepalive_handler(ngx_event_t *ev); static void ngx_http_set_lingering_close(ngx_http_request_t *r); static void ngx_http_lingering_close_handler(ngx_event_t *ev); +static void ngx_http_empty_handler(ngx_event_t *wev); static void ngx_http_header_parse_error(ngx_http_request_t *r, int parse_err); static size_t ngx_http_log_error(void *data, char *buf, size_t len); @@ -1001,6 +1002,8 @@ c = (ngx_connection_t *) r->connection; rev = c->read; + ngx_log_debug(c->log, "set http keepalive handler"); + ctx = (ngx_http_log_ctx_t *) c->log->data; ctx->action = "closing request"; ngx_http_close_request(r, 0); @@ -1061,10 +1064,15 @@ rev->event_handler = ngx_http_keepalive_handler; wev = c->write; - if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) { - if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) { - ngx_http_close_connection(c); - return; + if (wev->active) { + if (ngx_event_flags & NGX_USE_LEVEL_EVENT) { + if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) { + ngx_http_close_connection(c); + return; + } + + } else if ((ngx_event_flags & NGX_HAVE_AIO_EVENT) == 0) { + wev->event_handler = ngx_http_empty_handler; } } @@ -1158,11 +1166,16 @@ rev->blocked = 0; } - if (c->write->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) { - if (ngx_del_event(c->write, NGX_WRITE_EVENT, 0) == NGX_ERROR) { - ngx_http_close_request(r, 0); - ngx_http_close_connection(c); - return; + if (c->write->active) { + if (ngx_event_flags & NGX_USE_LEVEL_EVENT) { + if (ngx_del_event(c->write, NGX_WRITE_EVENT, 0) == NGX_ERROR) { + ngx_http_close_request(r, 0); + ngx_http_close_connection(c); + return; + } + + } else if ((ngx_event_flags & NGX_HAVE_AIO_EVENT) == 0) { + c->write->event_handler = ngx_http_empty_handler; } } @@ -1259,6 +1272,14 @@ } +static void ngx_http_empty_handler(ngx_event_t *wev) +{ + ngx_log_debug(wev->log, "http empty handler"); + + return; +} + + void ngx_http_close_request(ngx_http_request_t *r, int error) { ngx_http_log_ctx_t *ctx; @@ -1306,17 +1327,22 @@ c->read->timer_set = 0; } - if (c->read->active) { - ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); - } - if (c->write->timer_set) { ngx_del_timer(c->write); c->write->timer_set = 0; } - if (c->write->active) { - ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); + if (1) { + ngx_del_conn(c); + + } else { + if (c->read->active) { + ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); + } + + if (c->write->active) { + ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); + } } if (ngx_close_socket(c->fd) == -1) {
--- a/src/http/ngx_http_output_filter.c Wed May 21 13:28:21 2003 +0000 +++ b/src/http/ngx_http_output_filter.c Thu May 22 15:23:47 2003 +0000 @@ -58,15 +58,6 @@ #define next_filter (*ngx_http_top_body_filter) -#if 0 -static int (*next_filter) (ngx_http_request_t *r, ngx_chain_t *ch); -#endif - - -#if 0 -#define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter -#endif - #define need_to_copy(r, hunk) \ (((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \ && (hunk->type & NGX_HUNK_IN_MEMORY) == 0) \ @@ -159,6 +150,8 @@ return rc; } +ngx_log_debug(r->connection->log, "HERE"); + /* NGX_OK */ /* set our hunk free */ ctx->hunk->pos = ctx->hunk->last = ctx->hunk->start; @@ -211,6 +204,20 @@ return rc; } #endif + + if (ctx->incoming->hunk->type & NGX_HUNK_IN_MEMORY) { + size = ctx->incoming->hunk->last - ctx->incoming->hunk->pos; + + } else { + size = ctx->incoming->hunk->file_last + - ctx->incoming->hunk->file_pos; + } + + /* delete the completed hunk from the incoming chain */ + if (size == 0) { + ctx->incoming = ctx->incoming->next; + } + ctx->out.hunk = ctx->hunk; ctx->out.next = NULL; @@ -226,19 +233,8 @@ /* repeat until we will have copied the whole first hunk from the chain ctx->incoming */ - if (ctx->incoming->hunk->type & NGX_HUNK_IN_MEMORY) { - size = ctx->incoming->hunk->last - ctx->incoming->hunk->pos; - - } else { - size = ctx->incoming->hunk->file_last - - ctx->incoming->hunk->file_pos; - } - } while (size); - /* delete the completed hunk from the incoming chain */ - ctx->incoming = ctx->incoming->next; - /* repeat until we will have processed the whole chain ctx->incoming */ } while (ctx->incoming); @@ -276,6 +272,12 @@ } else { n = ngx_read_file(src->file, dst->pos, size, src->file_pos); +if (n == 0) { +ngx_log_debug(src->file->log, "READ: %qd:%qd %X:%X %X:%X" _ + src->file_pos _ src->file_last _ + dst->pos _ dst->last _ dst->start _ dst->end); +} + if (n == NGX_ERROR) { return n; }
--- a/src/os/unix/ngx_freebsd_config.h Wed May 21 13:28:21 2003 +0000 +++ b/src/os/unix/ngx_freebsd_config.h Thu May 22 15:23:47 2003 +0000 @@ -6,22 +6,16 @@ #include <stddef.h> /* offsetof */ #include <stdlib.h> #include <stdio.h> -#include <stdarg.h> #include <fcntl.h> #include <signal.h> -#include <string.h> -#include <time.h> #include <sys/types.h> -#include <sys/mman.h> -#include <sys/wait.h> -#include <sys/socket.h> +#include <sys/time.h> #include <sys/uio.h> #include <sys/ioctl.h> #include <sys/resource.h> +#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <netdb.h> - #include <osreldate.h>
--- a/src/os/unix/ngx_freebsd_init.c Wed May 21 13:28:21 2003 +0000 +++ b/src/os/unix/ngx_freebsd_init.c Thu May 22 15:23:47 2003 +0000 @@ -14,7 +14,7 @@ ngx_unix_recv, ngx_readv_chain, NULL, - ngx_freebsd_write_chain, + ngx_freebsd_sendfile_chain, NGX_HAVE_SENDFILE|NGX_HAVE_ZEROCOPY }; @@ -56,7 +56,7 @@ ngx_freebsd_kern_osreldate, __FreeBSD_version); -#if HAVE_FREEBSD_SENDFILE +#if (HAVE_FREEBSD_SENDFILE) /* The determination of the sendfile() nbytes bug is complex enough. There're two sendfile() syscalls: a new 393 has no bug while
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c Thu May 22 15:23:47 2003 +0000 @@ -0,0 +1,182 @@ + +#include <ngx_config.h> + +#include <ngx_core.h> +#include <ngx_types.h> +#include <ngx_alloc.h> +#include <ngx_array.h> +#include <ngx_hunk.h> +#include <ngx_connection.h> +#include <ngx_sendv.h> +#include <ngx_sendfile.h> +#include <ngx_freebsd_init.h> + + +ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) +{ + int rc; + char *prev; + size_t hsize, size; + off_t sent; + struct iovec *iov; + struct sf_hdtr hdtr; + ngx_err_t err; + ngx_array_t header, trailer; + ngx_hunk_t *file; + ngx_chain_t *ce; + + ce = in; + file = NULL; + hsize = 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); + + /* 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)) { + + if (prev == ce->hunk->pos) { + iov->iov_len += ce->hunk->last - ce->hunk->pos; + prev = ce->hunk->last; + + } 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; + } + + if (ngx_freebsd_sendfile_nbytes_bug) { + hsize += ce->hunk->last - ce->hunk->pos; + } + + ce = ce->next; + } + } + + /* TODO: coalesce the neighbouring file hunks */ + if (ce && (ce->hunk->type & NGX_HUNK_FILE)) { + file = ce->hunk; + ce = ce->next; + } + + /* create the trailer iovec */ + if (ce && 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)) { + + if (prev == ce->hunk->pos) { + iov->iov_len += ce->hunk->last - ce->hunk->pos; + prev = ce->hunk->last; + + } 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; + } + + ce = ce->next; + } + } + + if (file) { + hdtr.headers = (struct iovec *) header.elts; + hdtr.hdr_cnt = header.nelts; + hdtr.trailers = (struct iovec *) trailer.elts; + hdtr.trl_cnt = trailer.nelts; + + rc = sendfile(file->file->fd, c->fd, file->file_pos, + (size_t) (file->file_last - file->file_pos) + hsize, + &hdtr, &sent, 0); + + if (rc == -1) { + err = ngx_errno; + if (err == NGX_EAGAIN || err == NGX_EINTR) { + ngx_log_error(NGX_LOG_INFO, c->log, err, + "sendfile() sent only %qd bytes", sent); + + } else { + ngx_log_error(NGX_LOG_CRIT, c->log, err, "sendfile() failed"); + return NGX_CHAIN_ERROR; + } + } + +#if (NGX_DEBUG_WRITE_CHAIN) + ngx_log_debug(c->log, "sendfile: %d, @%qd %qd:%d" _ + rc _ file->file_pos _ sent _ + (size_t) (file->file_last - file->file_pos) + hsize); +#endif + + } 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"); + + } else if (err == NGX_EINTR) { + 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; + } + } + + sent = rc > 0 ? rc : 0; + } + +#if (NGX_DEBUG_WRITE_CHAIN) + ngx_log_debug(c->log, "sendv: %qd" _ sent); +#endif + + c->sent += sent; + + for (ce = in; ce && sent > 0; ce = ce->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 (sent >= size) { + sent -= size; + + if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { + ce->hunk->pos = ce->hunk->last; + } + + if (ce->hunk->type & NGX_HUNK_FILE) { + ce->hunk->file_pos = ce->hunk->file_last; + } + + continue; + } + + if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { + ce->hunk->pos += sent; + } + + if (ce->hunk->type & NGX_HUNK_FILE) { + ce->hunk->file_pos += sent; + } + + break; + } + + ngx_destroy_array(&trailer); + ngx_destroy_array(&header); + + return ce; +}
--- a/src/os/unix/ngx_freebsd_write_chain.c Wed May 21 13:28:21 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ - -#include <ngx_config.h> - -#include <ngx_core.h> -#include <ngx_types.h> -#include <ngx_alloc.h> -#include <ngx_array.h> -#include <ngx_hunk.h> -#include <ngx_connection.h> -#include <ngx_sendv.h> -#include <ngx_sendfile.h> -#include <ngx_freebsd_init.h> - - -ngx_chain_t *ngx_freebsd_write_chain(ngx_connection_t *c, ngx_chain_t *in) -{ - int rc; - char *prev; - size_t hsize, size; - off_t sent; - struct iovec *iov; - struct sf_hdtr hdtr; - ngx_err_t err; - ngx_array_t header, trailer; - ngx_hunk_t *file; - ngx_chain_t *ce; - - ce = in; - file = NULL; - hsize = 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); - - /* 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)) { - - if (prev == ce->hunk->pos) { - iov->iov_len += ce->hunk->last - ce->hunk->pos; - prev = ce->hunk->last; - - } 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; - } - - if (ngx_freebsd_sendfile_nbytes_bug) { - hsize += ce->hunk->last - ce->hunk->pos; - } - - ce = ce->next; - } - } - - /* TODO: coalesce the neighbouring file hunks */ - if (ce && (ce->hunk->type & NGX_HUNK_FILE)) { - file = ce->hunk; - ce = ce->next; - } - - /* create the trailer iovec */ - if (ce && 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)) { - - if (prev == ce->hunk->pos) { - iov->iov_len += ce->hunk->last - ce->hunk->pos; - prev = ce->hunk->last; - - } 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; - } - - ce = ce->next; - } - } - - if (file) { - hdtr.headers = (struct iovec *) header.elts; - hdtr.hdr_cnt = header.nelts; - hdtr.trailers = (struct iovec *) trailer.elts; - hdtr.trl_cnt = trailer.nelts; - - rc = sendfile(file->file->fd, c->fd, file->file_pos, - (size_t) (file->file_last - file->file_pos) + hsize, - &hdtr, &sent, 0); - - if (rc == -1) { - err = ngx_errno; - if (err == NGX_EAGAIN || err == NGX_EINTR) { - ngx_log_error(NGX_LOG_INFO, c->log, err, - "sendfile() sent only %qd bytes", sent); - - } else { - ngx_log_error(NGX_LOG_CRIT, c->log, err, "sendfile() failed"); - return NGX_CHAIN_ERROR; - } - } - -#if (NGX_DEBUG_WRITE_CHAIN) - ngx_log_debug(c->log, "sendfile: %d, @%qd %qd:%d" _ - rc _ file->file_pos _ sent _ - (size_t) (file->file_last - file->file_pos) + hsize); -#endif - - } 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"); - - } else if (err == NGX_EINTR) { - 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; - } - } - - sent = rc > 0 ? rc : 0; - } - -#if (NGX_DEBUG_WRITE_CHAIN) - ngx_log_debug(c->log, "sendv: %qd" _ sent); -#endif - - c->sent += sent; - - for (ce = in; ce && sent > 0; ce = ce->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 (sent >= size) { - sent -= size; - - if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { - ce->hunk->pos = ce->hunk->last; - } - - if (ce->hunk->type & NGX_HUNK_FILE) { - ce->hunk->file_pos = ce->hunk->file_last; - } - - continue; - } - - if (ce->hunk->type & NGX_HUNK_IN_MEMORY) { - ce->hunk->pos += sent; - } - - if (ce->hunk->type & NGX_HUNK_FILE) { - ce->hunk->file_pos += sent; - } - - break; - } - - ngx_destroy_array(&trailer); - ngx_destroy_array(&header); - - return ce; -}
--- a/src/os/unix/ngx_linux_config.h Wed May 21 13:28:21 2003 +0000 +++ b/src/os/unix/ngx_linux_config.h Thu May 22 15:23:47 2003 +0000 @@ -2,24 +2,34 @@ #define _NGX_LINUX_CONFIG_H_INCLUDED_ +#define _XOPEN_SOURCE 500 + + #include <unistd.h> #include <stddef.h> /* offsetof */ #include <stdlib.h> #include <stdio.h> -#include <stdarg.h> #include <fcntl.h> #include <signal.h> +#include <time.h> + +#define __USE_BSD #include <string.h> -#include <time.h> +#undef __USE_BSD + #include <sys/types.h> -#include <sys/mman.h> -#include <sys/wait.h> +#include <sys/time.h> +#include <sys/select.h> +#include <sys/uio.h> +#include <sys/ioctl.h> +#include <sys/resource.h> #include <sys/socket.h> -#include <sys/uio.h> -#include <sys/resource.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <netdb.h> + + +typedef unsigned int u_int; +typedef unsigned char u_char; #ifndef HAVE_SELECT
--- a/src/os/unix/ngx_solaris_config.h Wed May 21 13:28:21 2003 +0000 +++ b/src/os/unix/ngx_solaris_config.h Thu May 22 15:23:47 2003 +0000 @@ -4,29 +4,24 @@ #define SOLARIS 1 +#define _REENTRANT #define _FILE_OFFSET_BITS 64 /* must be before sys/types.h */ + #include <unistd.h> #include <stddef.h> /* offsetof */ #include <stdlib.h> #include <stdio.h> -#include <stdarg.h> #include <fcntl.h> -#include <time.h> #include <signal.h> -#include <string.h> -#include <strings.h> /* bzero() */ +#include <strings.h> + #include <sys/types.h> #include <sys/filio.h> /* FIONBIO */ #include <sys/stropts.h> /* INFTIM */ -#include <sys/mman.h> -#include <sys/wait.h> #include <sys/socket.h> -#include <sys/uio.h> -#include <sys/resource.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <netdb.h> typedef uint32_t u_int32_t;
--- a/src/os/unix/ngx_writev_chain.c Wed May 21 13:28:21 2003 +0000 +++ b/src/os/unix/ngx_writev_chain.c Thu May 22 15:23:47 2003 +0000 @@ -62,6 +62,8 @@ size = ce->hunk->last - ce->hunk->pos; +ngx_log_debug(c->log, "SIZE: %d" _ size); + if (sent >= size) { sent -= size; @@ -69,9 +71,11 @@ ce->hunk->pos = ce->hunk->last; } +#if 0 if (ce->hunk->type & NGX_HUNK_FILE) { ce->hunk->file_pos = ce->hunk->file_last; } +#endif continue; } @@ -80,9 +84,11 @@ ce->hunk->pos += sent; } +#if 0 if (ce->hunk->type & NGX_HUNK_FILE) { ce->hunk->file_pos += sent; } +#endif break; }