# debug
CFLAGS="$CFLAGS -g"
- CFLAGS="$CFLAGS -D HAVE_GCC_VARIADIC_MACROS=1"
+ have=HAVE_GCC_VARIADIC_MACROS . auto/have
OBJEXT=o
OBJOUT="-o "
# 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 "
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);
}
-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;
#define NGX_WRITE_EVENT POLLOUT
#define NGX_LEVEL_EVENT 0
+#define NGX_ONESHOT_EVENT 1
#elif (HAVE_EPOLL)
#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
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;
}
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;
}
#include <fcntl.h>
#include <string.h>
#include <signal.h>
+#include <limits.h>
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
/* 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;
}
#include <fcntl.h>
#include <string.h>
#include <signal.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
sendfilevec_t *sfv;
ngx_array_t vec;
ngx_event_t *wev;
- ngx_chain_t *cl;
+ ngx_chain_t *cl, *tail;
wev = c->write;
/* 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;
}
}
}
+ /*
+ * 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) {
in = cl;
- } while (eintr);
+ /* "tail == in" means that a single sendfilev() is complete */
+
+ } while ((tail && tail == in) || eintr);
if (in) {
wev->ready = 0;