summaryrefslogtreecommitdiff
path: root/devel/dbus
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2005-07-02 19:17:42 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2005-07-02 19:17:42 +0000
commit608020fae1ded72bb01f529b3b65604d90da99b9 (patch)
tree187486ec86845479841c35b2b530090313f74b21 /devel/dbus
parent- update to openwebmail-devel-2.51.20050627 (diff)
Fix a CPU hog problem with dbus running in fork mode. Kqueue is not shared
across fork(), and thus the file descriptor kevent was trying to read from was actually pointign to /dev/null. This caused dbus to eat up 100% of the CPU. Of course, tests with --nofork worked just fine. The new approach will detect if the kqueue has been closed, a reopen it after the fork.
Notes
Notes: svn path=/head/; revision=138351
Diffstat (limited to 'devel/dbus')
-rw-r--r--devel/dbus/Makefile2
-rw-r--r--devel/dbus/files/patch-bus_dir-watch.c19
2 files changed, 16 insertions, 5 deletions
diff --git a/devel/dbus/Makefile b/devel/dbus/Makefile
index 1adc8a415c20..ff195b042e6d 100644
--- a/devel/dbus/Makefile
+++ b/devel/dbus/Makefile
@@ -7,7 +7,7 @@
PORTNAME= dbus
PORTVERSION= 0.34
-PORTREVISION?= 0
+PORTREVISION?= 1
CATEGORIES?= devel gnome
MASTER_SITES= http://dbus.freedesktop.org/releases/
diff --git a/devel/dbus/files/patch-bus_dir-watch.c b/devel/dbus/files/patch-bus_dir-watch.c
index 497f5addf6d3..68af86766758 100644
--- a/devel/dbus/files/patch-bus_dir-watch.c
+++ b/devel/dbus/files/patch-bus_dir-watch.c
@@ -1,5 +1,5 @@
--- bus/dir-watch.c.orig Tue Jun 14 22:31:38 2005
-+++ bus/dir-watch.c Fri Jul 1 01:07:28 2005
++++ bus/dir-watch.c Sat Jul 2 15:07:55 2005
@@ -28,17 +28,25 @@
#include <stdlib.h>
#include <unistd.h>
@@ -28,7 +28,7 @@
/* use a static array to avoid handling OOM */
static int fds[MAX_DIRS_TO_WATCH];
static int num_fds = 0;
-@@ -92,6 +100,121 @@ bus_drop_all_directory_watches (void)
+@@ -92,6 +100,132 @@ bus_drop_all_directory_watches (void)
}
}
@@ -45,13 +45,24 @@
+_handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data)
+{
+ struct kevent ev;
++ int res;
++ pid_t pid;
+
-+ if (kevent (kq, NULL, 0, &ev, 1, NULL) > 0)
++ res = kevent (kq, NULL, 0, &ev, 1, NULL);
++
++ if (res > 0)
+ {
-+ pid_t pid = getpid ();
++ pid = getpid ();
+ _dbus_verbose ("Sending SIGHUP signal on reception of a kevent\n");
+ (void) kill (pid, SIGHUP);
+ }
++ else if (res < 0 && errno == EBADF)
++ {
++ kq = -1;
++ pid = getpid ();
++ _dbus_verbose ("Sending SIGHUP signal since kqueue has been closed\n");
++ (void) kill (pid, SIGHUP);
++ }
+
+ return TRUE;
+}