uloop: do less state/change tracking for kevent() on mac os x, it is unreliable

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
Felix Fietkau 2013-01-04 01:15:45 +01:00
parent 8686989fff
commit 6a8df07590
2 changed files with 5 additions and 17 deletions

15
uloop.c
View file

@ -88,23 +88,15 @@ static int register_poll(struct uloop_fd *fd, unsigned int flags)
{
struct timespec timeout = { 0, 0 };
struct kevent ev[2];
unsigned int changed;
int nev = 0;
unsigned int fl = 0;
uint16_t kflags;
changed = fd->kqflags ^ flags;
if (changed & ULOOP_EDGE_TRIGGER)
changed |= flags;
if (changed & ULOOP_READ) {
uint16_t kflags = get_flags(flags, ULOOP_READ);
kflags = get_flags(flags, ULOOP_READ);
EV_SET(&ev[nev++], fd->fd, EVFILT_READ, kflags, 0, 0, fd);
}
if (changed & ULOOP_WRITE) {
uint16_t kflags = get_flags(flags, ULOOP_WRITE);
kflags = get_flags(flags, ULOOP_WRITE);
EV_SET(&ev[nev++], fd->fd, EVFILT_WRITE, kflags, 0, 0, fd);
}
if (!flags)
fl |= EV_DELETE;
@ -112,7 +104,6 @@ static int register_poll(struct uloop_fd *fd, unsigned int flags)
if (nev && (kevent(poll_fd, ev, nev, NULL, fl, &timeout) == -1))
return -1;
fd->kqflags = flags;
return 0;
}

View file

@ -54,9 +54,6 @@ struct uloop_fd
bool eof;
bool error;
bool registered;
#ifdef USE_KQUEUE
uint8_t kqflags;
#endif
};
struct uloop_timeout