chiark / gitweb /
udevd: export current seqnum and add udevsettle
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index 701165b9ad0df601ecb53dcf53480843634ae0f9..8741a0901b1752e6088c5887c97f0dbd6bf9ea28 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -279,8 +279,23 @@ static void udev_event_run(struct uevent_msg *msg)
 
 static void msg_queue_insert(struct uevent_msg *msg)
 {
+       char filename[PATH_SIZE];
+       int fd;
+
        msg->queue_time = time(NULL);
 
+       strlcpy(filename, udev_root, sizeof(filename));
+       strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename));
+       fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644);
+       if (fd > 0) {
+               char str[32];
+               int len;
+
+               len = sprintf(str, "%llu\n", msg->seqnum);
+               write(fd, str, len);
+               close(fd);
+       }
+
        export_event_state(msg, EVENT_QUEUED);
 
        /* run all events with a timeout set immediately */