Mercurial > hg > nginx-vendor-0-7
diff src/os/unix/ngx_solaris_sendfilev_chain.c @ 22:8b6db3bda591 NGINX_0_1_11
nginx 0.1.11
*) Feature: the worker_priority directive.
*) Change: both tcp_nopush and tcp_nodelay directives affect the
transferred response.
*) Bugfix: nginx did not call initgroups().
Thanks to Andrew Sitnikov and Andrei Nigmatulin.
*) Change: now the ngx_http_autoindex_module shows the file size in the
bytes.
*) Bugfix: the ngx_http_autoindex_module returned the 500 error if the
broken symlink was in a directory.
*) Bugfix: the files bigger than 4G could not be transferred using
sendfile.
*) Bugfix: if the backend was resolved to several backends and there
was an error while the response waiting then process may got caught
in an endless loop.
*) Bugfix: the worker process may exit with the "unknown cycle" message
when the /dev/poll method was used.
*) Bugfix: "close() channel failed" errors.
*) Bugfix: the autodetection of the "nobody" and "nogroup" groups.
*) Bugfix: the send_lowat directive did not work on Linux.
*) Bugfix: the segmentation fault occurred if there was no events
section in configuration.
*) Bugfix: nginx could not be built on OpenBSD.
*) Bugfix: the double slashes in "://" in the URI were converted to
":/".
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 02 Dec 2004 00:00:00 +0300 |
parents | 46833bd150cb |
children | 45fe5b98a9de |
line wrap: on
line diff
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c +++ b/src/os/unix/ngx_solaris_sendfilev_chain.c @@ -9,6 +9,28 @@ #include <ngx_event.h> +#if (NGX_TEST_BUILD_SOLARIS_SENDFILEV) + +/* Solaris declarations */ + +typedef struct sendfilevec { + int sfv_fd; + u_int sfv_flag; + off_t sfv_off; + size_t sfv_len; +} sendfilevec_t; + +#define SFV_FD_SELF -2 + +static ssize_t sendfilev(int fd, const struct sendfilevec *vec, + int sfvcnt, size_t *xferred) +{ + return -1; +} + +#endif + + #define NGX_SENDFILEVECS 16 @@ -17,8 +39,9 @@ ngx_chain_t *ngx_solaris_sendfilev_chain { int fd; u_char *prev; - off_t fprev, sprev, send, aligned; - ssize_t size, sent, n; + off_t size, send, prev_send, aligned, fprev; + size_t sent; + ssize_t n; ngx_int_t eintr, complete; ngx_err_t err; sendfilevec_t *sfv, sfvs[NGX_SENDFILEVECS]; @@ -36,6 +59,14 @@ ngx_chain_t *ngx_solaris_sendfilev_chain return ngx_writev_chain(c, in, limit); } + + /* the maximum limit size is the maximum size_t value - the page size */ + + if (limit == 0 || limit > MAX_SIZE_T_VALUE - ngx_pagesize) { + limit = MAX_SIZE_T_VALUE - ngx_pagesize; + } + + send = 0; complete = 0; @@ -51,7 +82,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain sfv = NULL; eintr = 0; sent = 0; - sprev = send; + prev_send = send; vec.nelts = 0; @@ -73,7 +104,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain } if (prev == cl->buf->pos) { - sfv->sfv_len += size; + sfv->sfv_len += (size_t) size; } else { if (!(sfv = ngx_array_push(&vec))) { @@ -83,16 +114,16 @@ ngx_chain_t *ngx_solaris_sendfilev_chain sfv->sfv_fd = SFV_FD_SELF; sfv->sfv_flag = 0; sfv->sfv_off = (off_t) (uintptr_t) cl->buf->pos; - sfv->sfv_len = size; + sfv->sfv_len = (size_t) size; } - prev = cl->buf->pos + size; + prev = cl->buf->pos + (size_t) size; send += size; } else { prev = NULL; - size = (size_t) (cl->buf->file_last - cl->buf->file_pos); + size = cl->buf->file_last - cl->buf->file_pos; if (send + size > limit) { size = limit - send; @@ -106,7 +137,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain } if (fd == cl->buf->file->fd && fprev == cl->buf->file_pos) { - sfv->sfv_len += size; + sfv->sfv_len += (size_t) size; } else { if (!(sfv = ngx_array_push(&vec))) { @@ -117,7 +148,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain sfv->sfv_fd = fd; sfv->sfv_flag = 0; sfv->sfv_off = cl->buf->file_pos; - sfv->sfv_len = size; + sfv->sfv_len = (size_t) size; } fprev = cl->buf->file_pos + size; @@ -136,7 +167,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain } ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err, - "sendfilev() sent only %z bytes", sent); + "sendfilev() sent only %uz bytes", sent); } else { wev->error = 1; @@ -148,7 +179,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, "sendfilev: %z %z", n, sent); - if (send - sprev == sent) { + if (send - prev_send == (off_t) sent) { complete = 1; } @@ -166,8 +197,8 @@ ngx_chain_t *ngx_solaris_sendfilev_chain size = ngx_buf_size(cl->buf); - if (sent >= size) { - sent -= size; + if ((off_t) sent >= size) { + sent = (size_t) ((off_t) sent - size); if (ngx_buf_in_memory(cl->buf)) { cl->buf->pos = cl->buf->last;