Reverse the logic used for kevent. Set timeout to NULL when setting the event,

and timeout to the zero timespec when reading the event.
This commit is contained in:
Joe Marcus Clarke 2005-07-02 19:30:59 +00:00
parent 608020fae1
commit 668c6bf02c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=138352

View file

@ -1,5 +1,5 @@
--- bus/dir-watch.c.orig Tue Jun 14 22:31:38 2005 --- bus/dir-watch.c.orig Tue Jun 14 22:31:38 2005
+++ bus/dir-watch.c Sat Jul 2 15:07:55 2005 +++ bus/dir-watch.c Sat Jul 2 15:29:35 2005
@@ -28,17 +28,25 @@ @@ -28,17 +28,25 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -45,10 +45,11 @@
+_handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data) +_handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data)
+{ +{
+ struct kevent ev; + struct kevent ev;
+ struct timespec nullts = { 0, 0 };
+ int res; + int res;
+ pid_t pid; + pid_t pid;
+ +
+ res = kevent (kq, NULL, 0, &ev, 1, NULL); + res = kevent (kq, NULL, 0, &ev, 1, &nullts);
+ +
+ if (res > 0) + if (res > 0)
+ { + {
@ -78,7 +79,6 @@
+{ +{
+ int fd; + int fd;
+ struct kevent ev; + struct kevent ev;
+ static struct timespec nullts = { 0, 0 };
+ +
+ _dbus_assert (dir != NULL); + _dbus_assert (dir != NULL);
+ +
@ -129,7 +129,7 @@
+ EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, + EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
+ NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_LINK | NOTE_RENAME | + NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_LINK | NOTE_RENAME |
+ NOTE_REVOKE, 0, 0); + NOTE_REVOKE, 0, 0);
+ if (kevent (kq, &ev, 1, NULL, 0, &nullts) == -1) + if (kevent (kq, &ev, 1, NULL, 0, NULL) == -1)
+ { + {
+ _dbus_warn ("Cannot setup a kevent for '%s'; error '%s'\n", dir, _dbus_strerror (errno)); + _dbus_warn ("Cannot setup a kevent for '%s'; error '%s'\n", dir, _dbus_strerror (errno));
+ close (fd); + close (fd);