- /* don't delay messages with timeout set */
- if (msg->timeout) {
- info("seq %llu with timeout %u seconds will be execute without queuing, '%s' '%s'",
- msg->seqnum, msg->timeout, msg->action, msg->devpath);
- list_add(&msg->node, &exec_list);
- run_exec_q = 1;
+ udev = udev_device_init(NULL);
+ if (udev == NULL)
+ return -1;
+ strlcpy(udev->action, msg->action, sizeof(udev->action));
+ sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver);
+ udev->devt = msg->devt;
+
+ retval = udev_device_event(&rules, udev);
+
+ /* run programs collected by RUN-key*/
+ if (retval == 0 && !udev->ignore_device && udev_run)
+ retval = udev_rules_run(udev);
+
+ udev_device_cleanup(udev);
+ return retval;
+}
+
+enum event_state {
+ EVENT_QUEUED,
+ EVENT_FINISHED,
+ EVENT_FAILED,
+};
+
+static void export_event_state(struct udevd_uevent_msg *msg, enum event_state state)
+{
+ char filename[PATH_SIZE];
+ char filename_failed[PATH_SIZE];
+ size_t start;
+ struct udevd_uevent_msg *loop_msg;
+ int fd;
+
+ /* add location of queue files */
+ strlcpy(filename, udev_root, sizeof(filename));
+ strlcat(filename, "/", sizeof(filename));
+ start = strlcat(filename, EVENT_QUEUE_DIR"/", sizeof(filename));
+ strlcat(filename, msg->devpath, sizeof(filename));
+ path_encode(&filename[start], sizeof(filename) - start);
+
+ /* add location of failed files */
+ strlcpy(filename_failed, udev_root, sizeof(filename_failed));
+ strlcat(filename_failed, "/", sizeof(filename_failed));
+ start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed));
+ strlcat(filename_failed, msg->devpath, sizeof(filename_failed));
+ path_encode(&filename_failed[start], sizeof(filename) - start);
+
+ switch (state) {
+ case EVENT_QUEUED:
+ unlink(filename_failed);
+ delete_path(filename_failed);
+ create_path(filename);
+ fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644);
+ if (fd > 0)
+ close(fd);