+ /* set signal handlers */
+ memset(&act, 0x00, sizeof(act));
+ act.sa_handler = (void (*) (int))sig_handler;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction(SIGALRM, &act, NULL);
+ sigaction(SIGINT, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
+
+ /* trigger timeout to prevent hanging processes */
+ alarm(ALARM_TIMEOUT);
+
+ if (strstr(argv[0], "udevstart") || (argc == 2 && strstr(argv[1], "udevstart"))) {
+ dbg("udevstart");
+
+ /* disable all logging, as it's much too slow on some facilities */
+ udev_log = 0;
+
+ namedev_init();
+ retval = udev_start();
+ goto exit;
+ }
+
+ /* let the executed programs know if we handle the whole hotplug event */
+ managed_event = manage_hotplug_event();
+ if (managed_event)
+ setenv("MANAGED_EVENT", "1", 1);
+
+ action = getenv("ACTION");
+ devpath = getenv("DEVPATH");
+ subsystem = getenv("SUBSYSTEM");
+ /* older kernels passed the SUBSYSTEM only as argument */
+ if (!subsystem && argc == 2)
+ subsystem = argv[1];
+ udev_init_device(&udev, devpath, subsystem);
+
+ if (!action) {
+ dbg("no action");
+ goto hotplug;
+ }
+
+ if (!subsystem) {
+ dbg("no subsystem");
+ goto hotplug;
+ }
+
+ if (!devpath) {
+ dbg("no devpath");
+ goto hotplug;
+ }
+
+ /* export logging flag, as called scripts may want to do the same as udev */
+ if (udev_log)
+ setenv("UDEV_LOG", "1", 1);
+
+ if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) {