Hi all: I'm looking for a reliable way to find out if a given seqnum of uevent is proceeded. The best way I found was . read /dev/.udev/uevent_seqnum, make sure the uevent is enqueued already . look for /dev/.udev/queue/$seqnum -> if exist, not finished yet -> if not, finished or failed However, this is not a reliable way due to the fact that udevd write seqnum before export state into .udev/queue. Are there any other solution to this problem ? Or can we swap the order of writing seqnum and export state, like the attached patch do ? Thanks.
diff --git a/udevd.c b/udevd.c index c895c1d..d6977e9 100644 --- a/udevd.c +++ b/udevd.c @@ -269,6 +269,9 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) msg->queue_time = time(NULL); + export_event_state(msg, EVENT_QUEUED); + info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); + strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); @@ -281,9 +284,6 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) close(fd); } - export_event_state(msg, EVENT_QUEUED); - info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); - /* run one event after the other in debug mode */ if (debug_trace) { list_add_tail(&msg->node, &running_list);