nginx-0.3.16-RELEASE import

    *) Feature: the ngx_http_map_module.

    *) Feature: the "types_hash_max_size" and "types_hash_bucket_size"
       directives.

    *) Feature: the "ssi_value_length" directive.

    *) Feature: the "worker_rlimit_core" directive.

    *) Workaround: the connection number in logs was always 1 if nginx was
       built by the icc 8.1 or 9.0 compilers with optimization for
       Pentium 4.

    *) Bugfix: the "config timefmt" SSI command set incorrect time format.

    *) Bugfix: nginx did not close connection to IMAP/POP3 backend for the
       SSL connections; the bug had appeared in 0.3.13.
       Thanks to Rob Mueller.

    *) Bugfix: segmentation fault may occurred in at SSL shutdown; the bug
       had appeared in 0.3.13.
diff --git a/src/os/unix/ngx_alloc.c b/src/os/unix/ngx_alloc.c
index 72cf4e4..25606e2 100644
--- a/src/os/unix/ngx_alloc.c
+++ b/src/os/unix/ngx_alloc.c
@@ -8,7 +8,8 @@
 #include <ngx_core.h>
 
 
-int ngx_pagesize;
+int         ngx_pagesize;
+ngx_uint_t  ngx_cacheline_size;
 
 
 void *
diff --git a/src/os/unix/ngx_alloc.h b/src/os/unix/ngx_alloc.h
index 66562a1..a88818e 100644
--- a/src/os/unix/ngx_alloc.h
+++ b/src/os/unix/ngx_alloc.h
@@ -36,7 +36,8 @@
 #endif
 
 
-extern int ngx_pagesize;
+extern int         ngx_pagesize;
+extern ngx_uint_t  ngx_cacheline_size;
 
 
 #endif /* _NGX_ALLOC_H_INCLUDED_ */
diff --git a/src/os/unix/ngx_gcc_atomic_x86.h b/src/os/unix/ngx_gcc_atomic_x86.h
index b458032..8e3480d 100644
--- a/src/os/unix/ngx_gcc_atomic_x86.h
+++ b/src/os/unix/ngx_gcc_atomic_x86.h
@@ -61,7 +61,16 @@
  */
 
 
-#if !(__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+#if !(( __GNUC__ == 2 && __GNUC_MINOR__ <= 7 ) || ( __INTEL_COMPILER >= 800 ))
+
+/*
+ * icc 8.1 and 9.0 compile broken code with -march=pentium4 option:
+ * ngx_atomic_fetch_add() always return the input "add" value,
+ * so we use the gcc 2.7 version.
+ *
+ * icc 8.1 and 9.0 with -march=pentiumpro option or icc 7.1 compile
+ * correct code.
+ */
 
 static ngx_inline ngx_atomic_int_t
 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add)
@@ -77,7 +86,7 @@
 }
 
 
-#else /* (__GNUC__ == 2 && __GNUC_MINOR__ <= 7) */
+#else
 
 /*
  * gcc 2.7 does not support "+q", so we have to use the fixed %eax ("=a" and
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index f3830a8..225f9e1 100644
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -26,21 +26,21 @@
 ngx_chain_t *
 ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
 {
-    int              rc, tcp_nodelay;
-    u_char          *prev;
-    off_t            size, send, prev_send, aligned, sent, fprev;
-    size_t           file_size;
-    ngx_uint_t       eintr, complete;
-    ngx_err_t        err;
-    ngx_buf_t       *file;
-    ngx_array_t      header;
-    ngx_event_t     *wev;
-    ngx_chain_t     *cl;
-    struct iovec    *iov, headers[NGX_HEADERS];
+    int            rc, tcp_nodelay;
+    off_t          size, send, prev_send, aligned, sent, fprev;
+    u_char        *prev;
+    size_t         file_size;
+    ngx_err_t      err;
+    ngx_buf_t     *file;
+    ngx_uint_t     eintr, complete;
+    ngx_array_t    header;
+    ngx_event_t   *wev;
+    ngx_chain_t   *cl;
+    struct iovec  *iov, headers[NGX_HEADERS];
 #if (NGX_HAVE_SENDFILE64)
-    off_t            offset;
+    off_t          offset;
 #else
-    int32_t          offset;
+    int32_t        offset;
 #endif
 
     wev = c->write;
@@ -233,6 +233,12 @@
         }
 
         if (file) {
+#if 1
+            if (file_size == 0) {
+                ngx_debug_point();
+                return NGX_CHAIN_ERROR;
+            }
+#endif
 #if (NGX_HAVE_SENDFILE64)
             offset = file->file_pos;
 #else
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index 4968de5..83d5f30 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -39,6 +39,7 @@
     ngx_init_setproctitle(log);
 
     ngx_pagesize = getpagesize();
+    ngx_cacheline_size = NGX_CPU_CACHE_LINE;
 
     if (ngx_ncpu == 0) {
         ngx_ncpu = 1;
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 14bbe80..a262ba5 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -787,6 +787,17 @@
             }
         }
 
+        if (ccf->rlimit_core != NGX_CONF_UNSET) {
+            rlmt.rlim_cur = (rlim_t) ccf->rlimit_core;
+            rlmt.rlim_max = (rlim_t) ccf->rlimit_core;
+
+            if (setrlimit(RLIMIT_CORE, &rlmt) == -1) {
+                ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+                              "setrlimit(RLIMIT_CORE, %i) failed",
+                              ccf->rlimit_core);
+            }
+        }
+
 #ifdef RLIMIT_SIGPENDING
         if (ccf->rlimit_sigpending != NGX_CONF_UNSET) {
             rlmt.rlim_cur = (rlim_t) ccf->rlimit_sigpending;