summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-06-08 11:57:53 +0200
committerKay Sievers <kay.sievers@suse.de>2005-06-08 11:57:53 +0200
commit561d4c5a3a66830ecfb92fdfd7ccee19cf01c2a7 (patch)
tree2f8ed430597ddff43da2ced4e075e6d42b0b36ee
parent9607c4222c08c2d3def2faeac62f6cca5d3ce119 (diff)
udevd: allow starting of udevd with stopped exec-queue
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
-rwxr-xr-x[-rw-r--r--]test/simple-build-check.sh0
-rw-r--r--udevd.c16
-rw-r--r--udevstart.c10
3 files changed, 18 insertions, 8 deletions
diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh
index b653185b26..b653185b26 100644..100755
--- a/test/simple-build-check.sh
+++ b/test/simple-build-check.sh
diff --git a/udevd.c b/udevd.c
index b5597eab40..6fb0bd9433 100644
--- a/udevd.c
+++ b/udevd.c
@@ -766,6 +766,8 @@ int main(int argc, char *argv[], char *envp[])
fd_set readfds;
const char *value;
int uevent_nl_active = 0;
+ int daemonize = 0;
+ int i;
logging_init("udevd");
udev_init_config();
@@ -776,8 +778,18 @@ int main(int argc, char *argv[], char *envp[])
goto exit;
}
- /* daemonize on request */
- if (argc == 2 && strcmp(argv[1], "-d") == 0) {
+ for (i = 1 ; i < argc; i++) {
+ char *arg = argv[i];
+ if (strcmp(arg, "--daemon") == 0 || strcmp(arg, "-d") == 0) {
+ info("will daemonize");
+ daemonize = 1;
+ }
+ if (strcmp(arg, "--stop-exec-queue") == 0) {
+ info("will not execute event until START_EXEC_QUEUE is received");
+ stop_exec_q = 1;
+ }
+ }
+ if (daemonize) {
pid_t pid;
pid = fork();
diff --git a/udevstart.c b/udevstart.c
index d1a0a8379c..bd91e96f6a 100644
--- a/udevstart.c
+++ b/udevstart.c
@@ -117,30 +117,29 @@ static int add_device(const char *path, const char *subsystem)
class_dev = sysfs_open_class_device_path(path);
if (class_dev == NULL) {
- dbg ("sysfs_open_class_device_path failed");
+ dbg("sysfs_open_class_device_path failed");
return -1;
}
udev_init_device(&udev, devpath, subsystem, "add");
udev.devt = get_devt(class_dev);
if (!udev.devt) {
- dbg ("sysfs_open_class_device_path failed");
+ dbg("sysfs_open_class_device_path failed");
return -1;
}
udev_rules_get_name(&udev, class_dev);
if (udev.ignore_device) {
- info("device event will be ignored");
+ dbg("device event will be ignored");
goto exit;
}
if (udev.name[0] == '\0') {
- info("device node creation supressed");
+ dbg("device node creation supressed");
goto run;
}
udev_add_device(&udev, class_dev);
if (udev.devname[0] != '\0')
setenv("DEVNAME", udev.devname, 1);
-
run:
if (udev_run && !list_empty(&udev.run_list)) {
struct name_entry *name_loop;
@@ -149,7 +148,6 @@ run:
list_for_each_entry(name_loop, &udev.run_list, node)
execute_command(name_loop->name, udev.subsystem);
}
-
exit:
sysfs_close_class_device(class_dev);
udev_cleanup_device(&udev);