2 * udev_run_hotplugd.c - directory multiplexer
4 * Copyright (C) 2005 Kay Sievers <kay@vrfy.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation version 2 of the License.
21 #include <sys/types.h>
25 #include "../../udev_utils.h"
26 #include "../../list.h"
27 #include "../../logging.h"
28 #include "run_directory.h"
32 void log_message (int priority, const char *format, ...)
35 static int udev_log = -1;
40 value = getenv("UDEV_LOG");
42 udev_log = log_priority(value);
47 if (priority > udev_log)
50 va_start(args, format);
51 vsyslog(priority, format, args);
56 int main(int argc, char *argv[], char *envp[])
58 char dirname[NAME_SIZE];
59 const char *subsystem;
63 logging_init("udev_run_hotplugd");
65 fd = open("/dev/null", O_RDWR);
67 dup2(fd, STDOUT_FILENO);
68 dup2(fd, STDIN_FILENO);
69 dup2(fd, STDERR_FILENO);
73 dbg("running dev.d directory");
75 sprintf(dirname, "/etc/hotplug.d/%s", subsystem);
76 run_directory(dirname, ".hotplug", subsystem);
77 run_directory("/etc/hotplug.d/default", ".hotplug", subsystem);