nginx-0.0.1-2003-05-22-19:23:47 import
diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h
index f8066e5..73646fa 100644
--- a/src/os/unix/ngx_freebsd_config.h
+++ b/src/os/unix/ngx_freebsd_config.h
@@ -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>
 
 
diff --git a/src/os/unix/ngx_freebsd_init.c b/src/os/unix/ngx_freebsd_init.c
index aac8ed9..100dfc4 100644
--- a/src/os/unix/ngx_freebsd_init.c
+++ b/src/os/unix/ngx_freebsd_init.c
@@ -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
diff --git a/src/os/unix/ngx_freebsd_write_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
similarity index 98%
rename from src/os/unix/ngx_freebsd_write_chain.c
rename to src/os/unix/ngx_freebsd_sendfile_chain.c
index 0317ade..fc510b7 100644
--- a/src/os/unix/ngx_freebsd_write_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -12,7 +12,7 @@
 #include <ngx_freebsd_init.h>
 
 
-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)
 {
     int              rc;
     char            *prev;
diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
index 69a607e..e4c5dd0 100644
--- a/src/os/unix/ngx_linux_config.h
+++ b/src/os/unix/ngx_linux_config.h
@@ -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 <string.h>
 #include <time.h>
+
+#define __USE_BSD
+#include <string.h>
+#undef  __USE_BSD
+
 #include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/socket.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 <netinet/in.h>
 #include <arpa/inet.h>
-#include <netdb.h>
+
+
+typedef unsigned int   u_int;
+typedef unsigned char  u_char;
 
 
 #ifndef HAVE_SELECT
diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h
index 1545fc9..786cf0b 100644
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -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;
diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c
index fdaa52a..b667bc5 100644
--- a/src/os/unix/ngx_writev_chain.c
+++ b/src/os/unix/ngx_writev_chain.c
@@ -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;
     }