nginx-0.0.2-2004-02-03-23:27:11 import

This commit is contained in:
Igor Sysoev 2004-02-03 20:27:11 +00:00
parent 25b36fedf7
commit af57922780
10 changed files with 65 additions and 22 deletions

View File

@ -1,5 +1,5 @@
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
@ -33,9 +33,9 @@ END
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
@ -53,7 +53,7 @@ END
fi
fi
echo -n "$comma \"${fmt}\" is not appropriate"
echo $ngx_n "$comma \"${fmt}\" is not appropriate" $ngx_c
comma=","
done

View File

@ -1,5 +1,5 @@
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

View File

@ -1,5 +1,5 @@
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

View File

@ -6,3 +6,20 @@ NGX_MODULES_C=$OBJS/ngx_modules.c
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

View File

@ -1,5 +1,5 @@
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

View File

@ -1,5 +1,5 @@
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
@ -39,7 +39,7 @@ END
rm $NGX_AUTOTEST*
if [ $found = no ]; then
echo -n " $type not found"
echo $ngx_n " $type not found" $ngx_c
else
break
fi

View File

@ -1,5 +1,5 @@
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
@ -23,7 +23,7 @@ if [ -x $NGX_AUTOTEST ]; then
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*

View File

@ -130,6 +130,12 @@ static int ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags)
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;
@ -159,6 +165,9 @@ static int ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags)
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;
}
@ -195,13 +204,18 @@ static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags)
"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;
}
@ -232,8 +246,8 @@ static int ngx_poll_process_events(ngx_log_t *log)
#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);
@ -278,9 +292,9 @@ static int ngx_poll_process_events(ngx_log_t *log)
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)) {
@ -315,6 +329,18 @@ static int ngx_poll_process_events(ngx_log_t *log)
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;
}

View File

@ -136,7 +136,7 @@ static int ngx_select_add_event(ngx_event_t *ev, int event, u_int flags)
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;
}
@ -268,7 +268,7 @@ static int ngx_select_process_events(ngx_log_t *log)
#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;
}
@ -282,7 +282,7 @@ static int ngx_select_process_events(ngx_log_t *log)
#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);
}
@ -370,7 +370,7 @@ static int ngx_select_process_events(ngx_log_t *log)
for (i = 0; i < nevents; i++) {
ev = event_index[i];
c = (ngx_connection_t *) ev->data;
c = ev->data;
found = 0;
if (ev->write) {

View File

@ -471,7 +471,7 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
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;
}