+ struct sigaction act;
+ struct udevice *udev;
+ int i;
+ int retval;
+
+ /* set signal handlers */
+ memset(&act, 0x00, sizeof(act));
+ act.sa_handler = (void (*)(int)) udev_event_sig_handler;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction(SIGALRM, &act, NULL);
+
+ /* reset to default */
+ act.sa_handler = SIG_DFL;
+ sigaction(SIGINT, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
+ sigaction(SIGCHLD, &act, NULL);
+ sigaction(SIGHUP, &act, NULL);
+
+ /* trigger timeout to prevent hanging processes */
+ alarm(UDEV_ALARM_TIMEOUT);
+
+ /* reconstruct event environment from message */
+ for (i = 0; msg->envp[i]; i++)
+ putenv(msg->envp[i]);
+
+ 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;