nginx-0.0.2-2004-02-18-18:45:21 import

This commit is contained in:
Igor Sysoev 2004-02-18 15:45:21 +00:00
parent 22a7c50463
commit 8ae18a10d6
9 changed files with 28 additions and 10 deletions

View File

@ -24,7 +24,7 @@ case $CC in
# debug # debug
CFLAGS="$CFLAGS -g" CFLAGS="$CFLAGS -g"
CFLAGS="$CFLAGS -D HAVE_GCC_VARIADIC_MACROS=1" have=HAVE_GCC_VARIADIC_MACROS . auto/have
OBJEXT=o OBJEXT=o
OBJOUT="-o " OBJOUT="-o "
@ -50,7 +50,7 @@ case $CC in
# stop on warning # stop on warning
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Werror"
CFLAGS="$CFLAGS -D HAVE_C99_VARIADIC_MACROS=1" have=HAVE_C99_VARIADIC_MACROS . auto/have
OBJEXT=o OBJEXT=o
OBJOUT="-o " OBJOUT="-o "

View 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_add_connection(ngx_connection_t *c);
static int ngx_rtsig_del_connection(ngx_connection_t *c, u_int flags); 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_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 void *ngx_rtsig_create_conf(ngx_cycle_t *cycle);
static char *ngx_rtsig_init_conf(ngx_cycle_t *cycle, void *conf); 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) { if (ngx_poll_module_ctx.actions.process(log) == NGX_OK) {
ngx_event_actions = ngx_rtsig_module_ctx.actions; ngx_event_actions = ngx_rtsig_module_ctx.actions;

View File

@ -287,6 +287,7 @@ extern ngx_event_actions_t ngx_event_actions;
#define NGX_WRITE_EVENT POLLOUT #define NGX_WRITE_EVENT POLLOUT
#define NGX_LEVEL_EVENT 0 #define NGX_LEVEL_EVENT 0
#define NGX_ONESHOT_EVENT 1
#elif (HAVE_EPOLL) #elif (HAVE_EPOLL)

View File

@ -11,6 +11,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <limits.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
@ -71,6 +72,11 @@
#endif #endif
#ifndef IOV_MAX
#define IOV_MAX 1024
#endif
#ifndef HAVE_INHERITED_NONBLOCK #ifndef HAVE_INHERITED_NONBLOCK
#define HAVE_INHERITED_NONBLOCK 1 #define HAVE_INHERITED_NONBLOCK 1
#endif #endif

View File

@ -73,7 +73,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
prev = NULL; prev = NULL;
iov = 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)) { if (ngx_hunk_special(cl->hunk)) {
continue; continue;
} }
@ -123,7 +123,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
prev = NULL; prev = NULL;
iov = 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)) { if (ngx_hunk_special(cl->hunk)) {
continue; continue;
} }

View File

@ -17,6 +17,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <limits.h>
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>

View 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 */ /* 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)) { if (ngx_hunk_special(cl->hunk)) {
continue; continue;
} }

View File

@ -18,6 +18,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <limits.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>

View File

@ -16,7 +16,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
sendfilevec_t *sfv; sendfilevec_t *sfv;
ngx_array_t vec; ngx_array_t vec;
ngx_event_t *wev; ngx_event_t *wev;
ngx_chain_t *cl; ngx_chain_t *cl, *tail;
wev = c->write; 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 */ /* 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)) { if (ngx_hunk_special(cl->hunk)) {
continue; 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); n = sendfilev(c->fd, vec.elts, vec.nelts, &sent);
if (n == -1) { if (n == -1) {
@ -142,7 +149,9 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
in = cl; in = cl;
} while (eintr); /* "tail == in" means that a single sendfilev() is complete */
} while ((tail && tail == in) || eintr);
if (in) { if (in) {
wev->ready = 0; wev->ready = 0;