aboutsummaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2005-07-03 03:17:42 +0800
committermarcus <marcus@FreeBSD.org>2005-07-03 03:17:42 +0800
commit865dd49cc4388cd29f2ecdfe0054c9fc5282b796 (patch)
tree9501b8c34de1a30e55e1f907e4664078a96f30b1 /devel
parentf23ab41a5094189b79f53b9dc55e0365903a091b (diff)
downloadfreebsd-ports-gnome-865dd49cc4388cd29f2ecdfe0054c9fc5282b796.tar.gz
freebsd-ports-gnome-865dd49cc4388cd29f2ecdfe0054c9fc5282b796.tar.zst
freebsd-ports-gnome-865dd49cc4388cd29f2ecdfe0054c9fc5282b796.zip
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.
Diffstat (limited to 'devel')
-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;
+}