-echo -n "checking for $ngx_type printf() format ..."
+echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c
echo >> $NGX_ERR
echo "checking for $ngx_type printf() format" >> $NGX_ERR
if [ -x $NGX_AUTOTEST ]; then
if [ "`$NGX_AUTOTEST`" = $max_size ]; then
if [ $ngx_fmt_collect = yes ]; then
- echo -n "$comma \"${fmt}\" is appropriate"
+ echo $ngx_n "$comma \"${fmt}\" is appropriate" $ngx_c
else
- echo -n "$comma \"${fmt}\" used"
+ echo $ngx_n "$comma \"${fmt}\" used" $ngx_c
fi
ngx_fmt=$fmt
fi
fi
fi
- echo -n "$comma \"${fmt}\" is not appropriate"
+ echo $ngx_n "$comma \"${fmt}\" is not appropriate" $ngx_c
comma=","
done
-echo -n "checking for $ngx_func ..."
+echo $ngx_n "checking for $ngx_func ..." $ngx_c
echo >> $NGX_ERR
echo "checking for $ngx_func" >> $NGX_ERR
-echo -n "checking for $ngx_inc ..."
+echo $ngx_n "checking for $ngx_inc ..." $ngx_c
echo >> $NGX_ERR
echo "checking for $ngx_inc" >> $NGX_ERR
NGX_AUTOTEST=$OBJS/autotest
NGX_ERR=$OBJS/autoconf.err
+
+
+# checking echo's "-n" option and "\c" capabilties
+
+if echo "test\c" | grep c >/dev/null; then
+ if echo -n test | grep n >/dev/null; then
+ ngx_n=
+ ngx_c=
+ else
+ ngx_n=-n
+ ngx_c=
+ fi
+
+else
+ ngx_n=
+ ngx_c='\c'
+fi
-echo -n "checking for $ngx_type size ..."
+echo $ngx_n "checking for $ngx_type size ..." $ngx_c
echo >> $NGX_ERR
echo "checking for $ngx_type size" >> $NGX_ERR
-echo -n "checking for $ngx_type ..."
+echo $ngx_n "checking for $ngx_type ..." $ngx_c
echo >> $NGX_ERR
echo "checking for $ngx_type" >> $NGX_ERR
rm $NGX_AUTOTEST*
if [ $found = no ]; then
- echo -n " $type not found"
+ echo $ngx_n " $type not found" $ngx_c
else
break
fi
-echo -n "checking for uintptr_t ... "
+echo $ngx_n "checking for uintptr_t ... " $ngx_c
echo >> $NGX_ERR
echo "checking for uintptr_t" >> $NGX_ERR
echo " uintptr_t found"
found=yes
else
- echo -n " uintptr_t not found"
+ echo $ngx_n " uintptr_t not found" $ngx_c
fi
rm $NGX_AUTOTEST*
c = ev->data;
+ if (ev->index != NGX_INVALID_INDEX) {
+ ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
+ "poll event fd:%d ev:%d is already set", c->fd, event);
+ return NGX_OK;
+ }
+
ev->active = 1;
ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0;
nevents++;
} else {
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0,
+ "poll index: %d", e->index);
+
event_list[e->index].events |= event;
ev->index = e->index;
}
"poll del event: fd:%d ev:%d", c->fd, event);
if (e == NULL || e->index == NGX_INVALID_INDEX) {
- if (ev->index < (u_int) --nevents) {
+ nevents--;
+
+ if (ev->index < (u_int) nevents) {
event_list[ev->index] = event_list[nevents];
event_index[ev->index] = event_index[nevents];
event_index[ev->index]->index = ev->index;
}
} else {
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0,
+ "poll index: %d", e->index);
+
event_list[e->index].events &= ~event;
}
#if (NGX_DEBUG)
for (i = 0; i < nevents; i++) {
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0, "poll: fd:%d ev:%04X",
- event_list[i].fd, event_list[i].events);
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, 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);
for (i = 0; i < nevents && ready; i++) {
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
- "poll: fd:%d ev:%04X rev:%04X",
- event_list[i].fd,
+ ngx_log_debug4(NGX_LOG_DEBUG_EVENT, log, 0,
+ "poll: %d: fd:%d ev:%04X rev:%04X",
+ i, event_list[i].fd,
event_list[i].events, event_list[i].revents);
if (event_list[i].revents & (POLLERR|POLLHUP|POLLNVAL)) {
if (c->fd == -1) {
ngx_log_error(NGX_LOG_ALERT, log, 0, "unknown cycle");
+
+ /*
+ * it is certainly our fault and it should be investigated,
+ * in the meantime we disable this event to avoid a CPU spinning
+ */
+
+ if (i == nevents - 1) {
+ nevents--;
+ } else {
+ event_list[i].fd = -1;
+ }
+
continue;
}
if (ev->index != NGX_INVALID_INDEX) {
ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
- "%d:%d is already set", c->fd, event);
+ "select event fd:%d ev:%d is already set", c->fd, event);
return NGX_OK;
}
#if !(WIN32)
if (max_fd == -1) {
for (i = 0; i < nevents; i++) {
- c = (ngx_connection_t *) event_index[i]->data;
+ c = event_index[i]->data;
if (max_fd < c->fd) {
max_fd = c->fd;
}
#if (NGX_DEBUG)
for (i = 0; i < nevents; i++) {
ev = event_index[i];
- c = (ngx_connection_t *) ev->data;
+ c = ev->data;
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
"select event: fd:%d wr:%d", c->fd,ev->write);
}
for (i = 0; i < nevents; i++) {
ev = event_index[i];
- c = (ngx_connection_t *) ev->data;
+ c = ev->data;
found = 0;
if (ev->write) {
cycle->connection_n = ecf->connections;
- ngx_conf_init_value(ecf->multi_accept, 1);
+ ngx_conf_init_value(ecf->multi_accept, 0);
return NGX_CONF_OK;
}