nginx-0.0.1-2003-10-22-20:38:26 import
diff --git a/src/os/unix/freebsd/ngx_sendfile.c b/src/os/unix/freebsd/ngx_sendfile.c
deleted file mode 100644
index 8de85f6..0000000
--- a/src/os/unix/freebsd/ngx_sendfile.c
+++ /dev/null
@@ -1,66 +0,0 @@
-
-#include <ngx_config.h>
-
-#if (HAVE_FREEBSD_SENDFILE)
-
-#include <ngx_core.h>
-#include <ngx_types.h>
-#include <ngx_socket.h>
-#include <ngx_errno.h>
-#include <ngx_log.h>
-#include <ngx_connection.h>
-#include <ngx_sendv.h>
-#include <ngx_sendfile.h>
-
-/*
-  CHECK:
-       check sent if errno == EINTR then should return right sent.
-       EINTR should not occur according to man.
-*/
-
-
-int ngx_sendfile(ngx_connection_t *c,
-                 ngx_iovec_t *headers, int hdr_cnt,
-                 ngx_fd_t fd, off_t offset, size_t nbytes,
-                 ngx_iovec_t *trailers, int trl_cnt,
-                 off_t *sent, u_int flags)
-{
-    int             rc, i;
-    ngx_err_t       err;
-    struct sf_hdtr  hdtr;
-
-    hdtr.headers = headers;
-    hdtr.hdr_cnt = hdr_cnt;
-    hdtr.trailers = trailers;
-    hdtr.trl_cnt = trl_cnt;
-
-#if (HAVE_FREEBSD_SENDFILE_NBYTES_BUG)
-    for (i = 0; i < hdr_cnt; i++) {
-        nbytes += headers[i].iov_len;
-    }
-#endif
-
-    rc = sendfile(fd, c->fd, offset, nbytes, &hdtr, sent, flags);
-
-    if (rc == -1) {
-        err = ngx_errno;
-        if (err != NGX_EAGAIN && err != NGX_EINTR) {
-            ngx_log_error(NGX_LOG_ERR, c->log, err, "sendfile failed");
-
-            return NGX_ERROR;
-
-        } else {
-            ngx_log_error(NGX_LOG_INFO, c->log, err,
-                          "sendfile sent only %qd bytes", *sent);
-
-            return NGX_AGAIN;
-        }
-    }
-
-    ngx_log_debug(c->log, "sendfile: %d, @%qd %qd:%d" _
-                  rc _ offset _ *sent _ nbytes);
-
-    return NGX_OK;
-}
-
-#endif
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
index 093265a..b435625 100644
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -32,14 +32,14 @@
     ngx_err_t        err;
     ngx_array_t      header, trailer;
     ngx_hunk_t      *file;
-    ngx_chain_t     *ce, *tail;
+    ngx_chain_t     *cl, *tail;
 
     if (!c->write->ready) {
         return in;
     }
 
     do {
-        ce = in;
+        cl = in;
         file = NULL;
         fsize = 0;
         hsize = 0;
@@ -51,80 +51,80 @@
         ngx_init_array(trailer, c->pool, 10, sizeof(struct iovec),
                        NGX_CHAIN_ERROR);
 
-        /* create the iovec and coalesce the neighbouring chain entries */
+        /* create the header iovec and coalesce the neighbouring hunks */
 
         prev = NULL;
         iov = NULL;
 
-        for (ce = in; ce; ce = ce->next) {
-            if (ngx_hunk_special(ce->hunk)) {
+        for (cl = in; cl; cl = cl->next) {
+            if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
 
-            if (!ngx_hunk_in_memory_only(ce->hunk)) {
+            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;
+                prev = cl->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;
+                iov->iov_base = cl->hunk->pos;
+                iov->iov_len = cl->hunk->last - cl->hunk->pos;
+                prev = cl->hunk->last;
             }
 
-            hsize += ce->hunk->last - ce->hunk->pos;
+            hsize += cl->hunk->last - cl->hunk->pos;
         }
 
         /* get the file hunk */
 
-        if (ce && (ce->hunk->type & NGX_HUNK_FILE)) {
-            file = ce->hunk;
+        if (cl && (cl->hunk->type & NGX_HUNK_FILE)) {
+            file = cl->hunk;
             fsize = (size_t) (file->file_last - file->file_pos);
             fprev = file->file_last;
-            ce = ce->next;
+            cl = cl->next;
 
             /* coalesce the neighbouring file hunks */
 
-            while (ce && (ce->hunk->type & NGX_HUNK_FILE)) {
-                if (file->file->fd != ce->hunk->file->fd
-                    || fprev != ce->hunk->file_pos)
+            while (cl && (cl->hunk->type & NGX_HUNK_FILE)) {
+                if (file->file->fd != cl->hunk->file->fd
+                    || fprev != cl->hunk->file_pos)
                 {
                     break;
                 }
 
-                fsize += (size_t) (ce->hunk->file_last - ce->hunk->file_pos);
-                fprev = ce->hunk->file_last;
-                ce = ce->next;
+                fsize += (size_t) (cl->hunk->file_last - cl->hunk->file_pos);
+                fprev = cl->hunk->file_last;
+                cl = cl->next;
             }
         }
 
-        /* create the iovec and coalesce the neighbouring chain entries */
+        /* create the tailer iovec and coalesce the neighbouring hunks */
 
         prev = NULL;
         iov = NULL;
 
-        for ( /* void */; ce; ce = ce->next) {
-            if (ngx_hunk_special(ce->hunk)) {
+        for ( /* void */; cl; cl = cl->next) {
+            if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
 
-            if (!ngx_hunk_in_memory_only(ce->hunk)) {
+            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;
+                prev = cl->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;
+                iov->iov_base = cl->hunk->pos;
+                iov->iov_len = cl->hunk->last - cl->hunk->pos;
+                prev = cl->hunk->last;
             }
         }
 
@@ -133,7 +133,7 @@
          * a single sendfile() capability
          */
 
-        tail = ce;
+        tail = cl;
 
         if (file) {
 
@@ -155,7 +155,7 @@
             hdtr.trl_cnt = trailer.nelts;
 
             /*
-             * the old sendfile() "nbytes bug":
+             * the "nbytes bug" of the old sendfile() syscall:
              * http://www.freebsd.org/cgi/query-pr.cgi?pr=33771
              */
 
@@ -220,9 +220,9 @@
 
         c->sent += sent;
 
-        for (ce = in; ce; ce = ce->next) {
+        for (cl = in; cl; cl = cl->next) {
 
-            if (ngx_hunk_special(ce->hunk)) {
+            if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
 
@@ -230,41 +230,43 @@
                 break;
             }
 
-            size = ngx_hunk_size(ce->hunk);
+            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 (ce->hunk->type & NGX_HUNK_FILE) {
-                    ce->hunk->file_pos = ce->hunk->file_last;
+                if (cl->hunk->type & NGX_HUNK_FILE) {
+                    cl->hunk->file_pos = cl->hunk->file_last;
                 }
 
                 continue;
             }
 
-            if (ce->hunk->type & NGX_HUNK_IN_MEMORY) {
-                ce->hunk->pos += sent;
+            if (cl->hunk->type & NGX_HUNK_IN_MEMORY) {
+                cl->hunk->pos += sent;
             }
 
-            if (ce->hunk->type & NGX_HUNK_FILE) {
-                ce->hunk->file_pos += sent;
+            if (cl->hunk->type & NGX_HUNK_FILE) {
+                cl->hunk->file_pos += sent;
             }
 
             break;
         }
 
-        in = ce;
+        in = cl;
 
         if (eagain) {
+
             /*
              * sendfile() can return EAGAIN even if it has sent
              * a whole file part and successive sendfile() would
-             * return EAGAIN right away and would not send anything.
+             * return EAGAIN right away and would not send anything
              */
+
             c->write->ready = 0;
             break;
         }
diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c
index fe9a505..c83b076 100644
--- a/src/os/unix/ngx_readv_chain.c
+++ b/src/os/unix/ngx_readv_chain.c
@@ -4,7 +4,7 @@
 #include <ngx_event.h>
 
 
-ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *entry)
+ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
 {
     ssize_t        n;
     struct iovec  *iov;
@@ -19,19 +19,17 @@
 
     /* TODO: coalesce the neighbouring chain entries */
 
-    while (entry) {
+    while (chain) {
         ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
-        iov->iov_base = entry->hunk->last;
-        iov->iov_len = entry->hunk->end - entry->hunk->last;
-        entry = entry->next;
+        iov->iov_base = chain->hunk->last;
+        iov->iov_len = chain->hunk->end - chain->hunk->last;
+        chain = chain->next;
     }
 
 ngx_log_debug(c->log, "recv: %d:%d" _ io.nelts _ iov->iov_len);
 
     n = readv(c->fd, (struct iovec *) io.elts, io.nelts);
 
-    ngx_destroy_array(&io);
-
     if (n == -1) {
         c->read->ready = 0;