diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-06-04 01:44:04 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2009-06-04 01:44:04 +0200 |
commit | 1e03b754aef576a5cb75f01b1805cdc1f9cc292f (patch) | |
tree | 04fed54897345b57cfef598c3fe5eb00b93e53f8 /udev/udev-watch.c | |
parent | b61f48a0e8a4ad264bc0e904ea8bf3b054d5f562 (diff) |
udevd: convert to event worker processes
Event processes now get re-used after they handled an event. This reduces
pressure on the CPU significantly because cloned event processes no longer
cause page faults in the main daemon. After the events have settled, the
no longer needed worker processes get killed.
Diffstat (limited to 'udev/udev-watch.c')
-rw-r--r-- | udev/udev-watch.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 53492e5f35..5a49c963da 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -26,27 +26,24 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#ifdef HAVE_INOTIFY #include <sys/inotify.h> -#endif #include "udev.h" -int inotify_fd = -1; +static int inotify_fd = -1; /* inotify descriptor, will be shared with rules directory; * set to cloexec since we need our children to be able to add * watches for us */ -void udev_watch_init(struct udev *udev) +int udev_watch_init(struct udev *udev) { inotify_fd = inotify_init(); if (inotify_fd >= 0) util_set_fd_cloexec(inotify_fd); - else if (errno == ENOSYS) - info(udev, "unable to use inotify, udevd will not monitor rule files changes\n"); else err(udev, "inotify_init failed: %m\n"); + return inotify_fd; } /* move any old watches directory out of the way, and then restore |