summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-05-26 17:05:57 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-05-26 17:05:57 -0400
commitc0a12c12bac5d308758758e37662740094251391 (patch)
treea4e3a35d2c1e65b02f61abd113afe272b8509489
parenta23afd63bf9b1002aab9071ce481d3b8a844b27b (diff)
udevd: explicitly update queue file before answering to ping
This avoids updating the flag files twice for every loop, and also removes another dependency in the main-loop, so we are freer to reshufle it as we want. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r--src/udev/udevd.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index f9da6ff0d8..702c9c360c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -674,6 +674,20 @@ static void worker_returned(int fd_worker) {
}
}
+static void event_queue_update(void) {
+ int r;
+
+ if (!udev_list_node_is_empty(&event_list)) {
+ r = touch("/run/udev/queue");
+ if (r < 0)
+ log_warning_errno(r, "could not touch /run/udev/queue: %m");
+ } else {
+ r = unlink("/run/udev/queue");
+ if (r < 0 && errno != ENOENT)
+ log_warning("could not unlink /run/udev/queue: %m");
+ }
+}
+
/* receive the udevd message from userspace */
static void handle_ctrl_msg(struct udev_ctrl *uctrl) {
_cleanup_udev_ctrl_connection_unref_ struct udev_ctrl_connection *ctrl_conn = NULL;
@@ -746,8 +760,13 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) {
arg_children_max = i;
}
- if (udev_ctrl_get_ping(ctrl_msg) > 0)
+ if (udev_ctrl_get_ping(ctrl_msg) > 0) {
log_debug("udevd message (SYNC) received");
+ /* tell settle that we are busy or idle, this needs to be before the
+ * PING handling
+ */
+ event_queue_update();
+ }
if (udev_ctrl_get_exit(ctrl_msg) > 0) {
log_debug("udevd message (EXIT) received");
@@ -955,20 +974,6 @@ static void handle_signal(struct udev *udev, int signo) {
}
}
-static void event_queue_update(void) {
- int r;
-
- if (!udev_list_node_is_empty(&event_list)) {
- r = touch(UDEV_ROOT_RUN "/udev/queue");
- if (r < 0)
- log_warning_errno(r, "could not touch " UDEV_ROOT_RUN "/udev/queue: %m");
- } else {
- r = unlink(UDEV_ROOT_RUN "/udev/queue");
- if (r < 0 && errno != ENOENT)
- log_warning("could not unlink " UDEV_ROOT_RUN "/udev/queue: %m");
- }
-}
-
/*
* read the kernel command line, in case we need to get into debug mode
* udev.log-priority=<level> syslog priority
@@ -1506,11 +1511,6 @@ int main(int argc, char *argv[]) {
continue;
}
- /* 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