treate EINVAL as per fd error in kqueue; use argument for debug macros in

poll; version 1.1a; EINVAL fix from Nick Mathewson


svn:r168
This commit is contained in:
Niels Provos 2005-06-11 21:15:22 +00:00
parent 81bd0a0687
commit 9938aaf511
3 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@ dnl configure.in for libevent
dnl Dug Song <dugsong@monkey.org> dnl Dug Song <dugsong@monkey.org>
AC_INIT(event.c) AC_INIT(event.c)
AM_INIT_AUTOMAKE(libevent,1.0f) AM_INIT_AUTOMAKE(libevent,1.1a)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE AM_MAINTAINER_MODE

View File

@ -239,11 +239,14 @@ kq_dispatch(struct event_base *base, void *arg, struct timeval *tv)
* closed, * closed,
* ENOENT when the file discriptor was closed and * ENOENT when the file discriptor was closed and
* then reopened. * then reopened.
* EINVAL for some reasons not understood; EINVAL
* should not be returned ever; but FreeBSD does :-\
* An error is also indicated when a callback deletes * An error is also indicated when a callback deletes
* an event we are still processing. In that case * an event we are still processing. In that case
* the data field is set to ENOENT. * the data field is set to ENOENT.
*/ */
if (events[i].data == EBADF || if (events[i].data == EBADF ||
events[i].data == EINVAL ||
events[i].data == ENOENT) events[i].data == ENOENT)
continue; continue;
errno = events[i].data; errno = events[i].data;

2
poll.c
View File

@ -157,7 +157,7 @@ poll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
if (evsignal_deliver(&pop->evsigmask) == -1) if (evsignal_deliver(&pop->evsigmask) == -1)
return (-1); return (-1);
poll_check_ok(); poll_check_ok(pop);
sec = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000; sec = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000;
nfds = pop->nfds; nfds = pop->nfds;
res = poll(pop->event_set, nfds, sec); res = poll(pop->event_set, nfds, sec);