diff options
author | John Crispin <blogic@openwrt.org> | 2013-11-18 11:41:04 +0100 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-11-18 11:41:04 +0100 |
commit | d49096fea2499f118976fc6ad17e803847629eab (patch) | |
tree | b81970c5d732d6179bb7c42609f6f0a42c52d5b5 | |
parent | eb7c76ede8d0d41c7139c704236c6111da56da46 (diff) | |
download | unitd-d49096fea2499f118976fc6ad17e803847629eab.tar unitd-d49096fea2499f118976fc6ad17e803847629eab.zip |
add debug level handover between preinit and main process
Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r-- | initd/preinit.c | 6 | ||||
-rw-r--r-- | procd.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/initd/preinit.c b/initd/preinit.c index eeadbeb..c5f7ada 100644 --- a/initd/preinit.c +++ b/initd/preinit.c @@ -34,7 +34,7 @@ static void spawn_procd(struct uloop_process *proc, int ret) { char *wdt_fd = watchdog_fd(); - char *argv[] = { "/sbin/procd", NULL }; + char *argv[] = { "/sbin/procd", "-d", "0", NULL }; struct stat s; if (plugd_proc.pid > 0) @@ -49,6 +49,10 @@ spawn_procd(struct uloop_process *proc, int ret) DEBUG(2, "Exec to real procd now\n"); if (wdt_fd) setenv("WDTFD", wdt_fd, 1); + if (debug) + snprintf(argv[2], 2, "%d", debug & 0xf); + else + argv[1] = NULL; execvp(argv[0], argv); } @@ -32,7 +32,7 @@ static int usage(const char *prog) "Options:\n" "\t-s <path>\tPath to ubus socket\n" "\t-h <path>\trun as hotplug daemon\n" - "\td\t\tEnable debug messages\n" + "\t-d <level>\tEnable debug messages\n" "\n", prog); return 1; } @@ -41,7 +41,7 @@ int main(int argc, char **argv) { int ch; - while ((ch = getopt(argc, argv, "ds:h:")) != -1) { + while ((ch = getopt(argc, argv, "d:s:h:")) != -1) { switch (ch) { case 'h': return hotplug_run(optarg); @@ -49,7 +49,7 @@ int main(int argc, char **argv) ubus_socket = optarg; break; case 'd': - debug++; + debug = atoi(optarg); break; default: return usage(argv[0]); |