aboutsummaryrefslogtreecommitdiff
path: root/src/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/event')
-rw-r--r--src/event/modules/ngx_aio_module.c8
-rw-r--r--src/event/modules/ngx_devpoll_module.c35
-rw-r--r--src/event/modules/ngx_epoll_module.c30
-rw-r--r--src/event/modules/ngx_kqueue_module.c17
-rw-r--r--src/event/modules/ngx_poll_module.c46
-rw-r--r--src/event/modules/ngx_rtsig_module.c27
-rw-r--r--src/event/ngx_event.c6
7 files changed, 87 insertions, 82 deletions
diff --git a/src/event/modules/ngx_aio_module.c b/src/event/modules/ngx_aio_module.c
index 24516a423..f04ba8d22 100644
--- a/src/event/modules/ngx_aio_module.c
+++ b/src/event/modules/ngx_aio_module.c
@@ -14,7 +14,7 @@ static void ngx_aio_done(ngx_cycle_t *cycle);
static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_aio_del_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_aio_del_connection(ngx_connection_t *c, u_int flags);
-static int ngx_aio_process_events(ngx_log_t *log);
+static int ngx_aio_process_events(ngx_cycle_t *cycle);
ngx_os_io_t ngx_os_aio = {
@@ -53,7 +53,7 @@ ngx_module_t ngx_aio_module = {
NULL, /* module directives */
NGX_EVENT_MODULE, /* module type */
NULL, /* init module */
- NULL /* init child */
+ NULL /* init process */
};
@@ -137,9 +137,9 @@ static int ngx_aio_del_connection(ngx_connection_t *c, u_int flags)
}
-static int ngx_aio_process_events(ngx_log_t *log)
+static int ngx_aio_process_events(ngx_cycle_t *cycle)
{
- return ngx_kqueue_module_ctx.actions.process(log);
+ return ngx_kqueue_module_ctx.actions.process(cycle);
}
#endif /* HAVE_KQUEUE */
diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c
index e8204cd63..41188ae53 100644
--- a/src/event/modules/ngx_devpoll_module.c
+++ b/src/event/modules/ngx_devpoll_module.c
@@ -36,7 +36,7 @@ static void ngx_devpoll_done(ngx_cycle_t *cycle);
static int ngx_devpoll_add_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_devpoll_del_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_devpoll_set_event(ngx_event_t *ev, int event, u_int flags);
-static int ngx_devpoll_process_events(ngx_log_t *log);
+static int ngx_devpoll_process_events(ngx_cycle_t *cycle);
static void *ngx_devpoll_create_conf(ngx_cycle_t *cycle);
static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf);
@@ -308,13 +308,15 @@ static int ngx_devpoll_set_event(ngx_event_t *ev, int event, u_int flags)
}
-int ngx_devpoll_process_events(ngx_log_t *log)
+int ngx_devpoll_process_events(ngx_cycle_t *cycle)
{
- int events, i, j;
+ int events;
+ ngx_int_t i;
+ ngx_uint_t j;
size_t n;
ngx_msec_t timer;
ngx_err_t err;
- ngx_cycle_t **cycle;
+ ngx_cycle_t **old_cycle;
ngx_connection_t *c;
ngx_epoch_msec_t delta;
struct dvpoll dvp;
@@ -327,12 +329,13 @@ int ngx_devpoll_process_events(ngx_log_t *log)
timer = (ngx_msec_t) INFTIM;
}
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0, "devpoll timer: %d", timer);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+ "devpoll timer: %d", timer);
if (nchanges) {
n = nchanges * sizeof(struct pollfd);
if (write(dp, change_list, n) != (ssize_t) n) {
- ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"write(/dev/poll) failed");
return NGX_ERROR;
}
@@ -359,18 +362,18 @@ int ngx_devpoll_process_events(ngx_log_t *log)
if (err) {
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
- log, err, "ioctl(DP_POLL) failed");
+ cycle->log, err, "ioctl(DP_POLL) failed");
return NGX_ERROR;
}
if (timer != (ngx_msec_t) INFTIM) {
delta = ngx_elapsed_msec - delta;
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"devpoll timer: %d, delta: %d", timer, (int) delta);
} else {
if (events == 0) {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ioctl(DP_POLL) returned no events without timeout");
return NGX_ERROR;
}
@@ -380,12 +383,12 @@ int ngx_devpoll_process_events(ngx_log_t *log)
c = &ngx_cycle->connections[event_list[i].fd];
if (c->fd == -1) {
- cycle = ngx_old_cycles.elts;
+ old_cycle = ngx_old_cycles.elts;
for (j = 0; j < ngx_old_cycles.nelts; j++) {
- if (cycle[i] == NULL) {
+ if (old_cycle[j] == NULL) {
continue;
}
- c = &cycle[j]->connections[event_list[i].fd];
+ c = &old_cycle[j]->connections[event_list[i].fd];
if (c->fd != -1) {
break;
}
@@ -393,17 +396,17 @@ int ngx_devpoll_process_events(ngx_log_t *log)
}
if (c->fd == -1) {
- ngx_log_error(NGX_LOG_EMERG, log, 0, "unknown cycle");
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "unknown cycle");
exit(1);
}
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"devpoll: fd:%d, ev:%04X, rev:%04X",
event_list[i].fd,
event_list[i].events, event_list[i].revents);
if (event_list[i].revents & (POLLERR|POLLHUP|POLLNVAL)) {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"ioctl(DP_POLL) error fd:%d ev:%04X rev:%04X",
event_list[i].fd,
event_list[i].events, event_list[i].revents);
@@ -411,7 +414,7 @@ int ngx_devpoll_process_events(ngx_log_t *log)
if (event_list[i].revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL))
{
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"strange ioctl(DP_POLL) events "
"fd:%d ev:%04X rev:%04X",
event_list[i].fd,
diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c
index 0b2b7d258..3f534ff17 100644
--- a/src/event/modules/ngx_epoll_module.c
+++ b/src/event/modules/ngx_epoll_module.c
@@ -76,7 +76,7 @@ static int ngx_epoll_add_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_epoll_add_connection(ngx_connection_t *c);
static int ngx_epoll_del_connection(ngx_connection_t *c);
-static int ngx_epoll_process_events(ngx_log_t *log);
+static int ngx_epoll_process_events(ngx_cycle_t *cycle);
static void *ngx_epoll_create_conf(ngx_cycle_t *cycle);
static char *ngx_epoll_init_conf(ngx_cycle_t *cycle, void *conf);
@@ -337,14 +337,13 @@ static int ngx_epoll_del_connection(ngx_connection_t *c)
#endif
-int ngx_epoll_process_events(ngx_log_t *log)
+int ngx_epoll_process_events(ngx_cycle_t *cycle)
{
int events;
ngx_int_t instance, i;
size_t n;
ngx_msec_t timer;
ngx_err_t err;
- ngx_cycle_t **cycle;
struct timeval tv;
ngx_connection_t *c;
ngx_epoch_msec_t delta;
@@ -357,7 +356,8 @@ int ngx_epoll_process_events(ngx_log_t *log)
timer = (ngx_msec_t) -1;
}
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0, "epoll timer: %d", timer);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+ "epoll timer: %d", timer);
events = epoll_wait(ep, event_list, nevents, timer);
@@ -376,11 +376,11 @@ int ngx_epoll_process_events(ngx_log_t *log)
if (timer != (ngx_msec_t) -1) {
delta = ngx_elapsed_msec - delta;
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"epoll timer: %d, delta: %d", timer, (int) delta);
} else {
if (events == 0) {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"epoll_wait() returned no events without timeout");
return NGX_ERROR;
}
@@ -388,7 +388,7 @@ int ngx_epoll_process_events(ngx_log_t *log)
if (err) {
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
- log, err, "epoll_wait() failed");
+ cycle->log, err, "epoll_wait() failed");
return NGX_ERROR;
}
@@ -398,7 +398,15 @@ int ngx_epoll_process_events(ngx_log_t *log)
instance = (uintptr_t) c & 1;
c = (ngx_connection_t *) ((uintptr_t) c & (uintptr_t) ~1);
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
+ if (event_list[i].events & EPOLLIN) {
+ c->read->returned_instance = instance;
+ }
+
+ if (event_list[i].events & EPOLLOUT) {
+ c->write->returned_instance = instance;
+ }
+
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"epoll: fd:%d ev:%04X d:" PTR_FMT,
c->fd, event_list[i].events, event_list[i].data);
@@ -409,19 +417,19 @@ int ngx_epoll_process_events(ngx_log_t *log)
* that was just closed in this iteration
*/
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"epoll: stale event " PTR_FMT, c);
continue;
}
if (event_list[i].events & (EPOLLERR|EPOLLHUP)) {
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"epoll_wait() error on fd:%d ev:%04X",
c->fd, event_list[i].events);
}
if (event_list[i].events & ~(EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP)) {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"strange epoll_wait() events fd:%d ev:%04X",
c->fd, event_list[i].events);
}
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 9f0cd1857..7c39d80b9 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -346,7 +346,8 @@ static int ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags)
static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle)
{
int events;
- ngx_int_t i, instance;
+ ngx_int_t i;
+ ngx_uint_t instance;
ngx_err_t err;
ngx_msec_t timer;
ngx_event_t *ev;
@@ -517,10 +518,7 @@ static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle)
}
-#if 0
- if (ngx_threaded || ngx_accept_token) {
-#endif
- if (ngx_accept_mutex_held) {
+ if (ngx_threaded || ngx_accept_mutex_held) {
if (ev->accept) {
ngx_mutex_unlock(ngx_posted_events_mutex);
@@ -533,7 +531,7 @@ static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle)
}
} else {
- ev->next = ngx_posted_events;
+ ev->next = (ngx_event_t *) ngx_posted_events;
ngx_posted_events = ev;
}
@@ -551,11 +549,9 @@ static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle)
ngx_event_expire_timers((ngx_msec_t) delta);
}
-#if (NGX_THREADS)
if (ngx_threaded) {
return NGX_OK;
}
-#endif
for ( ;; ) {
@@ -598,11 +594,6 @@ static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle)
static void ngx_kqueue_thread_handler(ngx_event_t *ev)
{
- ngx_int_t instance;
-
- instance = (uintptr_t) ev & 1;
- ev = (ngx_event_t *) ((uintptr_t) ev & (uintptr_t) ~1);
-
if ((!ev->posted && !ev->active)
|| ev->instance != ev->returned_instance)
{
diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c
index c8ea197b6..7b86ae576 100644
--- a/src/event/modules/ngx_poll_module.c
+++ b/src/event/modules/ngx_poll_module.c
@@ -13,7 +13,7 @@ static int ngx_poll_init(ngx_cycle_t *cycle);
static void ngx_poll_done(ngx_cycle_t *cycle);
static int ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags);
static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags);
-int ngx_poll_process_events(ngx_log_t *log);
+int ngx_poll_process_events(ngx_cycle_t *cycle);
static struct pollfd *event_list;
@@ -49,7 +49,7 @@ ngx_module_t ngx_poll_module = {
NULL, /* module directives */
NGX_EVENT_MODULE, /* module type */
NULL, /* init module */
- NULL /* init child */
+ NULL /* init process */
};
@@ -161,7 +161,7 @@ static int ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags)
static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags)
{
- ngx_int_t i;
+ ngx_uint_t i;
ngx_cycle_t **cycle;
ngx_event_t *e;
ngx_connection_t *c;
@@ -245,13 +245,14 @@ static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags)
}
-int ngx_poll_process_events(ngx_log_t *log)
+int ngx_poll_process_events(ngx_cycle_t *cycle)
{
int ready;
- ngx_int_t i, j, nready, found;
+ ngx_int_t i, nready;
+ ngx_uint_t n, found;
ngx_msec_t timer;
ngx_err_t err;
- ngx_cycle_t **cycle;
+ ngx_cycle_t **old_cycle;
ngx_event_t *ev;
ngx_epoch_msec_t delta;
ngx_connection_t *c;
@@ -272,11 +273,12 @@ int ngx_poll_process_events(ngx_log_t *log)
#if (NGX_DEBUG0)
for (i = 0; i < nevents; i++) {
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, "poll: %d: fd:%d ev:%04X",
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+ "poll: %d: fd:%d ev:%04X",
i, event_list[i].fd, event_list[i].events);
}
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0, "poll timer: %d", timer);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "poll timer: %d", timer);
#endif
ready = poll(event_list, (u_int) nevents, (int) timer);
@@ -293,23 +295,23 @@ int ngx_poll_process_events(ngx_log_t *log)
delta = ngx_elapsed_msec;
ngx_elapsed_msec = tv.tv_sec * 1000 + tv.tv_usec / 1000 - ngx_start_msec;
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"poll ready %d of %d", ready, nevents);
if (err) {
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
- log, err, "poll() failed");
+ cycle->log, err, "poll() failed");
return NGX_ERROR;
}
if (timer != (ngx_msec_t) INFTIM) {
delta = ngx_elapsed_msec - delta;
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"poll timer: %d, delta: %d", timer, (int) delta);
} else {
if (ready == 0) {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"poll() returned no events without timeout");
return NGX_ERROR;
}
@@ -325,13 +327,13 @@ int ngx_poll_process_events(ngx_log_t *log)
for (i = 0; i < nevents && ready; i++) {
#if 0
- ngx_log_debug4(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"poll: %d: fd:%d ev:%04X rev:%04X",
i, event_list[i].fd,
event_list[i].events, event_list[i].revents);
#else
if (event_list[i].revents) {
- ngx_log_debug4(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"poll: %d: fd:%d ev:%04X rev:%04X",
i, event_list[i].fd,
event_list[i].events, event_list[i].revents);
@@ -339,7 +341,7 @@ int ngx_poll_process_events(ngx_log_t *log)
#endif
if (event_list[i].revents & (POLLERR|POLLHUP|POLLNVAL)) {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"poll() error fd:%d ev:%04X rev:%04X",
event_list[i].fd,
event_list[i].events, event_list[i].revents);
@@ -347,7 +349,7 @@ int ngx_poll_process_events(ngx_log_t *log)
if (event_list[i].revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL))
{
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"strange poll() events fd:%d ev:%04X rev:%04X",
event_list[i].fd,
event_list[i].events, event_list[i].revents);
@@ -363,12 +365,12 @@ int ngx_poll_process_events(ngx_log_t *log)
c = &ngx_cycle->connections[event_list[i].fd];
if (c->fd == -1) {
- cycle = ngx_old_cycles.elts;
- for (j = 0; j < ngx_old_cycles.nelts; j++) {
- if (cycle[j] == NULL) {
+ old_cycle = ngx_old_cycles.elts;
+ for (n = 0; n < ngx_old_cycles.nelts; n++) {
+ if (old_cycle[n] == NULL) {
continue;
}
- c = &cycle[j]->connections[event_list[i].fd];
+ c = &old_cycle[n]->connections[event_list[i].fd];
if (c->fd != -1) {
break;
}
@@ -376,7 +378,7 @@ int ngx_poll_process_events(ngx_log_t *log)
}
if (c->fd == -1) {
- ngx_log_error(NGX_LOG_ALERT, log, 0, "unexpected event");
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "unexpected event");
/*
* it is certainly our fault and it should be investigated,
@@ -435,7 +437,7 @@ int ngx_poll_process_events(ngx_log_t *log)
}
if (ready != 0) {
- ngx_log_error(NGX_LOG_ALERT, log, 0, "poll ready != events");
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "poll ready != events");
}
if (timer != (ngx_msec_t) INFTIM && delta) {
diff --git a/src/event/modules/ngx_rtsig_module.c b/src/event/modules/ngx_rtsig_module.c
index 99b255560..5686b6eec 100644
--- a/src/event/modules/ngx_rtsig_module.c
+++ b/src/event/modules/ngx_rtsig_module.c
@@ -39,8 +39,8 @@ static int ngx_rtsig_init(ngx_cycle_t *cycle);
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_overflow(ngx_log_t *log);
+static int ngx_rtsig_process_events(ngx_cycle_t *cycle);
+static int ngx_rtsig_process_overflow(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);
@@ -188,14 +188,13 @@ static int ngx_rtsig_del_connection(ngx_connection_t *c, u_int flags)
}
-int ngx_rtsig_process_events(ngx_log_t *log)
+int ngx_rtsig_process_events(ngx_cycle_t *cycle)
{
int signo;
ngx_int_t instance, i;
size_t n;
ngx_msec_t timer;
ngx_err_t err;
- ngx_cycle_t **cycle;
siginfo_t si;
struct timeval tv;
struct timespec ts, *tp;
@@ -216,7 +215,8 @@ int ngx_rtsig_process_events(ngx_log_t *log)
tp = NULL;
}
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0, "rtsig timer: %d", timer);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+ "rtsig timer: %d", timer);
/* Linux sigwaitinfo() is sigtimedwait() with the NULL timeout pointer */
@@ -236,18 +236,18 @@ int ngx_rtsig_process_events(ngx_log_t *log)
if (err) {
ngx_log_error((err == NGX_EINTR) ? NGX_LOG_INFO : NGX_LOG_ALERT,
- log, err, "sigtimedwait() failed");
+ cycle->log, err, "sigtimedwait() failed");
return NGX_ERROR;
}
if (timer) {
delta = ngx_elapsed_msec - delta;
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"rtsig timer: %d, delta: %d", timer, (int) delta);
}
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"signo:%d fd:%d band:%X", signo, si.si_fd, si.si_band);
rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
@@ -255,6 +255,7 @@ int ngx_rtsig_process_events(ngx_log_t *log)
if (signo == rtscf->signo) {
/* TODO: old_cycles */
+
c = &ngx_cycle->connections[si.si_fd];
/* TODO: stale signals */
@@ -274,7 +275,7 @@ int ngx_rtsig_process_events(ngx_log_t *log)
}
} else if (signo == SIGIO) {
- ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"signal queue overflowed: "
"SIGIO, fd:%d, band:%X", si.si_fd, si.si_band);
@@ -284,7 +285,7 @@ int ngx_rtsig_process_events(ngx_log_t *log)
sa.sa_handler = SIG_DFL;
sigemptyset(&sa.sa_mask);
if (sigaction(rtscf->signo, &sa, NULL) == -1) {
- ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"sigaction(%d, SIG_DFL) failed", rtscf->signo);
}
@@ -297,7 +298,7 @@ int ngx_rtsig_process_events(ngx_log_t *log)
} else {
- ngx_log_error(NGX_LOG_ALERT, log, 0,
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"sigtimedwait() returned unexpected signal: %d", signo);
return NGX_ERROR;
}
@@ -310,9 +311,9 @@ int ngx_rtsig_process_events(ngx_log_t *log)
}
-static int ngx_rtsig_process_overflow(ngx_log_t *log)
+static int ngx_rtsig_process_overflow(ngx_cycle_t *cycle)
{
- if (ngx_poll_module_ctx.actions.process(log) == NGX_OK) {
+ if (ngx_poll_module_ctx.actions.process(cycle) == NGX_OK) {
ngx_event_actions = ngx_rtsig_module_ctx.actions;
ngx_event_flags = NGX_USE_SIGIO_EVENT;
}
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index 7bfda0448..9c8411400 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -155,9 +155,9 @@ static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle)
return NGX_OK;
}
- ngx_accept_mutex_ptr = mmap(NULL, sizeof(ngx_atomic_t),
- PROT_READ|PROT_WRITE,
- MAP_ANON|MAP_SHARED, -1, 0);
+ ngx_accept_mutex_ptr = (ngx_atomic_t *) mmap(NULL, sizeof(ngx_atomic_t),
+ PROT_READ|PROT_WRITE,
+ MAP_ANON|MAP_SHARED, -1, 0);
if (ngx_accept_mutex_ptr == NULL) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,