aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_linux_sendfile_chain.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-11-27 19:01:37 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-11-27 19:01:37 +0000
commit764543e73426fd00741483ff830cf09bfb73752f (patch)
tree27b8bad85c18469e593d30ee137fdb5fe1a16af4 /src/os/unix/ngx_linux_sendfile_chain.c
parent0e499db3ed63432cfacd08282cce1d42b568b567 (diff)
downloadnginx-764543e73426fd00741483ff830cf09bfb73752f.tar.gz
nginx-764543e73426fd00741483ff830cf09bfb73752f.zip
nginx-0.0.1-2003-11-27-22:01:37 import
Diffstat (limited to 'src/os/unix/ngx_linux_sendfile_chain.c')
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index 0b8e41792..9b311b21e 100644
--- 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(ngx_connection_t *c, ngx_chain_t *in)
{
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(ngx_connection_t *c, ngx_chain_t *in)
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) {