]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.0.2-2004-02-18-18:45:21 import
authorIgor Sysoev <igor@sysoev.ru>
Wed, 18 Feb 2004 15:45:21 +0000 (15:45 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 18 Feb 2004 15:45:21 +0000 (15:45 +0000)
auto/cc
src/event/modules/ngx_rtsig_module.c
src/event/ngx_event.h
src/os/unix/ngx_freebsd_config.h
src/os/unix/ngx_freebsd_sendfile_chain.c
src/os/unix/ngx_linux_config.h
src/os/unix/ngx_linux_sendfile_chain.c
src/os/unix/ngx_solaris_config.h
src/os/unix/ngx_solaris_sendfilev_chain.c

diff --git a/auto/cc b/auto/cc
index 082b13f7520b589a5d1c7e9dc0c1e79842274201..6edae8815d58cff615861ba00bdedc6eb7966956 100644 (file)
--- a/auto/cc
+++ b/auto/cc
@@ -24,7 +24,7 @@ case $CC in
          # debug
          CFLAGS="$CFLAGS -g"
 
-         CFLAGS="$CFLAGS -D HAVE_GCC_VARIADIC_MACROS=1"
+         have=HAVE_GCC_VARIADIC_MACROS . auto/have
 
          OBJEXT=o
          OBJOUT="-o "
@@ -50,7 +50,7 @@ case $CC in
          # stop on warning
          CFLAGS="$CFLAGS -Werror"
 
-         CFLAGS="$CFLAGS -D HAVE_C99_VARIADIC_MACROS=1"
+         have=HAVE_C99_VARIADIC_MACROS . auto/have
 
          OBJEXT=o
          OBJOUT="-o "
index 32c544a8d3ddd07ad63ec741f72e3a9af531dc62..99b25556003901e8283b4d61e86320315a2e3fc6 100644 (file)
@@ -40,7 +40,7 @@ static void ngx_rtsig_done(ngx_cycle_t *cycle);
 static int ngx_rtsig_add_connection(ngx_connection_t *c);
 static int ngx_rtsig_del_connection(ngx_connection_t *c, u_int flags);
 static int ngx_rtsig_process_events(ngx_log_t *log);
-static int ngx_rtsig_process_overlow(ngx_log_t *log);
+static int ngx_rtsig_process_overflow(ngx_log_t *log);
 
 static void *ngx_rtsig_create_conf(ngx_cycle_t *cycle);
 static char *ngx_rtsig_init_conf(ngx_cycle_t *cycle, void *conf);
@@ -310,7 +310,7 @@ int ngx_rtsig_process_events(ngx_log_t *log)
 }
 
 
-static int ngx_rtsig_process_overlow(ngx_log_t *log)
+static int ngx_rtsig_process_overflow(ngx_log_t *log)
 {
     if (ngx_poll_module_ctx.actions.process(log) == NGX_OK) {
         ngx_event_actions = ngx_rtsig_module_ctx.actions;
index 1a05751a183143f2e526a1ae1b627d3d83be1442..83ce81436f4c1471b37177193cfb3b1e970449a4 100644 (file)
@@ -287,6 +287,7 @@ extern ngx_event_actions_t   ngx_event_actions;
 #define NGX_WRITE_EVENT    POLLOUT
 
 #define NGX_LEVEL_EVENT    0
+#define NGX_ONESHOT_EVENT  1
 
 
 #elif (HAVE_EPOLL)
index 3d53d2026927bfadc7b6cd5ced6ed5b1a19aa3c5..e447340a88a00ac42a0718d2f08eaeaedde69fbb 100644 (file)
@@ -11,6 +11,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <signal.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #endif
 
 
+#ifndef IOV_MAX
+#define IOV_MAX   1024
+#endif
+
+
 #ifndef HAVE_INHERITED_NONBLOCK
 #define HAVE_INHERITED_NONBLOCK  1
 #endif
index f784b1f1df21680785590c2f51f00c8f3d5ae81a..d5e1831bcf18a94b845fbb1d7585b8b6a50281d1 100644 (file)
@@ -73,7 +73,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
         prev = NULL;
         iov = NULL;
 
-        for (cl = in; cl; cl = cl->next) {
+        for (cl = in; cl && header.nelts < IOV_MAX; cl = cl->next) {
             if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
@@ -123,7 +123,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
         prev = NULL;
         iov = NULL;
 
-        for ( /* void */; cl; cl = cl->next) {
+        for ( /* void */; cl && trailer.nelts < IOV_MAX; cl = cl->next) {
             if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
index 1ca1c1f0d239ccb945abc5ab02dd9ee495ebb36c..23745df0776b3a77b489b07cd663f81786b0eb7d 100644 (file)
@@ -17,6 +17,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <signal.h>
+#include <limits.h>
 #include <time.h>
 #include <sys/types.h>
 #include <sys/time.h>
index 39c2e831dadc7fd4c7d131027ece8b028ecf6e63..4fa8f835cf20f762fa83079f5f076cedd6978a84 100644 (file)
@@ -52,7 +52,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
 
         /* create the iovec and coalesce the neighbouring hunks */
 
-        for (cl = in; cl; cl = cl->next) {
+        for (cl = in; cl && header.nelts < IOV_MAX; cl = cl->next) {
             if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
index f4f8df2afd5d3695cdd365cb14109a6b11be3f9c..db74aebe5d153e097f692a00892ae8b256a5239d 100644 (file)
@@ -18,6 +18,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <signal.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
index a5b741f270f99bc1de3409ef42ec08df4a711356..9cd1618a33282288cb5b54459729724e336898f9 100644 (file)
@@ -16,7 +16,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
     sendfilevec_t  *sfv;
     ngx_array_t     vec;
     ngx_event_t    *wev;
-    ngx_chain_t    *cl;
+    ngx_chain_t    *cl, *tail;
 
     wev = c->write;
 
@@ -37,7 +37,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
 
         /* create the sendfilevec and coalesce the neighbouring hunks */
 
-        for (cl = in; cl; cl = cl->next) {
+        for (cl = in; cl && vec.nelts < IOV_MAX; cl = cl->next) {
             if (ngx_hunk_special(cl->hunk)) {
                 continue;
             }
@@ -77,6 +77,13 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
             }
         }
 
+        /*
+         * the tail is the rest of the chain that exceeded a single
+         * sendfilev() capability, IOV_MAX in Solaris is only 16
+         */
+
+        tail = cl;
+
         n = sendfilev(c->fd, vec.elts, vec.nelts, &sent);
 
         if (n == -1) {
@@ -142,7 +149,9 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
 
         in = cl;
 
-    } while (eintr);
+        /* "tail == in" means that a single sendfilev() is complete */
+
+    } while ((tail && tail == in) || eintr);
 
     if (in) {
         wev->ready = 0;