summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-23 05:19:19 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:29:51 +0200
commite3707dc9deb28d5144836032a54dbc028247835d (patch)
treed480512d98e76f5e72d5238f286e5604172d303d /main.c
parent0ef322973a8b9dc9c0f5ba8155ad780016f3654f (diff)
Add a global cmdline file
* main.c (argp_parser, main): Add the --kernel-pid option. * main.h: Publish it. * rootdir.c (rootdir_gc_cmdline): New function.
Diffstat (limited to 'main.c')
-rw-r--r--main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main.c b/main.c
index 26f5248..fee4867 100644
--- a/main.c
+++ b/main.c
@@ -14,6 +14,7 @@
int opt_clk_tck;
mode_t opt_stat_mode;
pid_t opt_fake_self;
+pid_t opt_kernel_pid;
static error_t
argp_parser (int key, char *arg, struct argp_state *state)
@@ -44,6 +45,12 @@ argp_parser (int key, char *arg, struct argp_state *state)
else
opt_fake_self = 1;
break;
+
+ case 'k':
+ opt_kernel_pid = strtol (arg, &endp, 0);
+ if (*endp || ! *arg || (signed) opt_kernel_pid < 0)
+ error (1, 0, "--kernel-process: PID must be a positive integer");
+ break;
}
return 0;
@@ -64,6 +71,9 @@ struct argp argp = {
"Provide a fake \"self\" symlink to the given PID, for compatibility "
"purposes. If PID is omitted, \"self\" will point to init. "
"(default: no self link)" },
+ { "kernel-process", 'k', "PID", 0,
+ "Process identifier for the kernel, used to retreive its command line "
+ "(default: 2)" },
{}
},
.parser = argp_parser,
@@ -112,6 +122,7 @@ int main (int argc, char **argv)
opt_clk_tck = sysconf(_SC_CLK_TCK);
opt_stat_mode = 0400;
opt_fake_self = -1;
+ opt_kernel_pid = 2;
argp_parse (&argp, argc, argv, 0, 0, 0);
task_get_bootstrap_port (mach_task_self (), &bootstrap);