X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudevd.c;h=1c510f44ff6728d477373ef4edddc02d5d0e42e5;hb=d42688ef21a695f8a30b0d899dafdc6ff1ee0973;hp=009e2fed754992c622a6fb3d9bdf38569b34f406;hpb=1fa2f38f0f011010bf57522b42fcc168856a7003;p=elogind.git diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 009e2fed7..1c510f44f 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -26,25 +26,19 @@ #include #include #include -#include #include -#include #include -#include #include #include #include #include -#include #include #include #include -#include #include #include #include #include -#include #include "sd-daemon.h" #include "rtnl-util.h" @@ -909,6 +903,17 @@ static void handle_signal(struct udev *udev, int signo) { } } +static void event_queue_update(void) { + if (!udev_list_node_is_empty(&event_list)) { + int fd; + + fd = open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); + if (fd >= 0) + close(fd); + } else + unlink("/run/udev/queue"); +} + static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) { int ctrl = -1, netlink = -1; int fd, n; @@ -1369,15 +1374,7 @@ int main(int argc, char *argv[]) { } /* tell settle that we are busy or idle */ - if (!udev_list_node_is_empty(&event_list)) { - int fd; - - fd = open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); - if (fd >= 0) - close(fd); - } else { - unlink("/run/udev/queue"); - } + event_queue_update(); fdcount = epoll_wait(fd_ep, ev, ELEMENTSOF(ev), timeout); if (fdcount < 0) @@ -1502,6 +1499,11 @@ int main(int argc, char *argv[]) { if (is_inotify) handle_inotify(udev); + /* tell settle that we are busy or idle, this needs to be before the + * PING handling + */ + event_queue_update(); + /* * This needs to be after the inotify handling, to make sure, * that the ping is send back after the possibly generated