Add a half-second delay before HUP'ing the system daemon when the system.d

contents change.  This avoids a race with install(1) that causes dbus
to die.  Also, adjust the list of kevent notes to be closer to what dnotify
is using in Linux.
This commit is contained in:
Joe Marcus Clarke 2006-05-02 17:04:09 +00:00
parent bc4b4c1a98
commit 12eacf0e3d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=161205
2 changed files with 8 additions and 5 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= dbus PORTNAME= dbus
PORTVERSION= 0.61 PORTVERSION= 0.61
PORTREVISION?= 1 PORTREVISION?= 2
CATEGORIES?= devel gnome CATEGORIES?= devel gnome
MASTER_SITES= http://dbus.freedesktop.org/releases/ MASTER_SITES= http://dbus.freedesktop.org/releases/

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 Sun Jul 3 02:07:14 2005 +++ bus/dir-watch.c Tue May 2 12:52:08 2006
@@ -28,17 +28,25 @@ @@ -28,17 +28,25 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -28,7 +28,7 @@
/* use a static array to avoid handling OOM */ /* use a static array to avoid handling OOM */
static int fds[MAX_DIRS_TO_WATCH]; static int fds[MAX_DIRS_TO_WATCH];
static int num_fds = 0; static int num_fds = 0;
@@ -92,6 +100,144 @@ bus_drop_all_directory_watches (void) @@ -92,6 +100,147 @@ bus_drop_all_directory_watches (void)
} }
} }
@ -59,6 +59,10 @@
+ +
+ res = kevent (kq, NULL, 0, &ev, 1, &nullts); + res = kevent (kq, NULL, 0, &ev, 1, &nullts);
+ +
+ /* Sleep for half a second to avoid a race when files are install(1)'d
+ * to system.d. */
+ usleep(500000);
+
+ if (res > 0) + if (res > 0)
+ { + {
+ pid = getpid (); + pid = getpid ();
@ -139,8 +143,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_RENAME, 0, 0);
+ NOTE_REVOKE, 0, 0);
+ if (kevent (kq, &ev, 1, NULL, 0, NULL) == -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));