-static int max_childs_running;
-static char udev_log[32];
-
-static LIST_HEAD(exec_list);
-static LIST_HEAD(running_list);
-
-
-#ifdef USE_LOG
-void log_message(int priority, const char *format, ...)
-{
- va_list args;
-
- if (priority > udev_log_priority)
- return;
-
- va_start(args, format);
- if (debug) {
- printf("[%d] ", (int) getpid());
- vprintf(format, args);
- } else
- vsyslog(priority, format, args);
- va_end(args);
-}
-
-#endif
-
-static void asmlinkage udev_event_sig_handler(int signum)
-{
- if (signum == SIGALRM)
- exit(1);
-}
-
-static int udev_event_process(struct udevd_uevent_msg *msg)
-{
- 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_EVENT_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->devpath_old = msg->devpath_old;
- udev->devt = msg->devt;
-
- retval = udev_device_event(&rules, udev);
-
- /* rules may change/disable the timeout */
- if (udev->event_timeout >= 0)
- alarm(udev->event_timeout);
-
- /* 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;
-}