mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-03-01 00:00:00 +07:00
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>
This commit is contained in:
parent
a23afd63bf
commit
c0a12c12ba
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user