uloop: do less state/change tracking for kevent() on mac os x, it is unreliable
authorFelix Fietkau <nbd@openwrt.org>
Fri, 4 Jan 2013 00:15:45 +0000 (01:15 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 4 Jan 2013 00:15:48 +0000 (01:15 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uloop.c
uloop.h

diff --git a/uloop.c b/uloop.c
index f4f5e023160f3d92fb019a845343e871d196dcb2..2de94f5fa5aa2a55b881989ec8f88c93d49a1f68 100644 (file)
--- a/uloop.c
+++ b/uloop.c
@@ -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;
+       kflags = get_flags(flags, ULOOP_READ);
+       EV_SET(&ev[nev++], fd->fd, EVFILT_READ, kflags, 0, 0, fd);
 
-       if (changed & ULOOP_READ) {
-               uint16_t 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);
-               EV_SET(&ev[nev++], fd->fd, EVFILT_WRITE, kflags, 0, 0, fd);
-       }
+       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;
 }
 
diff --git a/uloop.h b/uloop.h
index 05007fa946fc1bc7e7a44f1db7b0a6768e468019..4be2913e3e35129de712643e9e99b811580c7601 100644 (file)
--- a/uloop.h
+++ b/uloop.h
@@ -54,9 +54,6 @@ struct uloop_fd
        bool eof;
        bool error;
        bool registered;
-#ifdef USE_KQUEUE
-       uint8_t kqflags;
-#endif
 };
 
 struct uloop_timeout