diff options
| author | Doug Barton <dougb@FreeBSD.org> | 2005-12-29 04:22:58 +0000 |
|---|---|---|
| committer | Doug Barton <dougb@FreeBSD.org> | 2005-12-29 04:22:58 +0000 |
| commit | 51396b745e15e1903dda8e529e90dbb2467464d5 (patch) | |
| tree | b117ca43de9734ad580fc24bbff46b66e9563833 /contrib/bind9/lib/bind/isc/ev_files.c | |
| parent | ec9cc1fc128b225f088d46c4b8351a8dee5d0eed (diff) | |
| parent | a00aca3467ce973cd6d2414c81fd5e39559374b3 (diff) | |
Notes
Diffstat (limited to 'contrib/bind9/lib/bind/isc/ev_files.c')
| -rw-r--r-- | contrib/bind9/lib/bind/isc/ev_files.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/contrib/bind9/lib/bind/isc/ev_files.c b/contrib/bind9/lib/bind/isc/ev_files.c index 4d5eb55ad8d5..1f95ed04c999 100644 --- a/contrib/bind9/lib/bind/isc/ev_files.c +++ b/contrib/bind9/lib/bind/isc/ev_files.c @@ -20,7 +20,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: ev_files.c,v 1.3.2.1.4.1 2004/03/09 08:33:42 marka Exp $"; +static const char rcsid[] = "$Id: ev_files.c,v 1.3.2.1.4.3 2005/07/28 07:43:19 marka Exp $"; #endif #include "port_before.h" @@ -58,8 +58,10 @@ evSelectFD(evContext opaqueCtx, ctx, fd, eventmask, func, uap); if (eventmask == 0 || (eventmask & ~EV_MASK_ALL) != 0) EV_ERR(EINVAL); +#ifndef USE_POLL if (fd > ctx->highestFD) EV_ERR(EINVAL); +#endif OK(mode = fcntl(fd, F_GETFL, NULL)); /* side effect: validate fd. */ /* @@ -68,6 +70,11 @@ evSelectFD(evContext opaqueCtx, * of our deselect()'s have to leave it in O_NONBLOCK. If not, then * all but our last deselect() has to leave it in O_NONBLOCK. */ +#ifdef USE_POLL + /* Make sure both ctx->pollfds[] and ctx->fdTable[] are large enough */ + if (fd >= ctx->maxnfds && evPollfdRealloc(ctx, 1, fd) != 0) + EV_ERR(ENOMEM); +#endif /* USE_POLL */ id = FindFD(ctx, fd, EV_MASK_ALL); if (id == NULL) { if (mode & PORT_NONBLOCK) @@ -143,13 +150,6 @@ evSelectFD(evContext opaqueCtx, if (opaqueID) opaqueID->opaque = id; - evPrintf(ctx, 5, - "evSelectFD(fd %d, mask 0x%x): new masks: 0x%lx 0x%lx 0x%lx\n", - fd, eventmask, - (u_long)ctx->rdNext.fds_bits[0], - (u_long)ctx->wrNext.fds_bits[0], - (u_long)ctx->exNext.fds_bits[0]); - return (0); } @@ -204,7 +204,7 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) { * and (b) the caller didn't ask us anything about O_NONBLOCK. */ #ifdef USE_FIONBIO_IOCTL - int off = 1; + int off = 0; (void) ioctl(del->fd, FIONBIO, (char *)&off); #else (void) fcntl(del->fd, F_SETFL, mode & ~PORT_NONBLOCK); @@ -259,13 +259,6 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) { if (del == ctx->fdNext) ctx->fdNext = del->next; - evPrintf(ctx, 5, - "evDeselectFD(fd %d, mask 0x%x): new masks: 0x%lx 0x%lx 0x%lx\n", - del->fd, eventmask, - (u_long)ctx->rdNext.fds_bits[0], - (u_long)ctx->wrNext.fds_bits[0], - (u_long)ctx->exNext.fds_bits[0]); - /* Couldn't free it before now since we were using fields out of it. */ FREE(del); |
