Mercurial > hg > nginx-quic
diff src/os/unix/ngx_linux_sendfile_chain.c @ 198:34995c5ec6c4
nginx-0.0.1-2003-11-27-22:01:37 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 27 Nov 2003 19:01:37 +0000 |
parents | 11fbd0fc041d |
children | a65b630b3a66 |
line wrap: on
line diff
--- a/src/os/unix/ngx_linux_sendfile_chain.c +++ b/src/os/unix/ngx_linux_sendfile_chain.c @@ -8,7 +8,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ng { int rc; char *prev; - off_t offset; + off_t fprev; size_t size, fsize, sent; ngx_int_t use_cork, eintr; struct iovec *iov; @@ -17,6 +17,11 @@ ngx_chain_t *ngx_linux_sendfile_chain(ng ngx_array_t header; ngx_event_t *wev; ngx_chain_t *cl, *tail; +#if (HAVE_SENDFILE64) + off_t offset; +#else + int32_t offset; +#endif wev = c->write; @@ -82,20 +87,20 @@ ngx_log_debug(c->log, "CORK"); file = cl->hunk; fsize = (size_t) (file->file_last - file->file_pos); - offset = file->file_last; + fprev = file->file_last; cl = cl->next; /* coalesce the neighbouring file hunks */ while (cl && (cl->hunk->type & NGX_HUNK_FILE)) { if (file->file->fd != cl->hunk->file->fd - || offset != cl->hunk->file_pos) + || fprev != cl->hunk->file_pos) { break; } fsize += (size_t) (cl->hunk->file_last - cl->hunk->file_pos); - offset = cl->hunk->file_last; + fprev = cl->hunk->file_last; cl = cl->next; } } @@ -108,7 +113,11 @@ ngx_log_debug(c->log, "CORK"); tail = cl; if (fsize) { +#if (HAVE_SENDFILE64) offset = file->file_pos; +#else + offset = (int32_t) file->file_pos; +#endif rc = sendfile(c->fd, file->file->fd, &offset, fsize); if (rc == -1) {