From 8d16db0cc28b2d911aee918d5c3582ad29ddfeed Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 18 Sep 2013 15:59:31 +0200 Subject: Add proc_set_init_task, make runsystem pid 1 * hurd/process.defs (proc_set_init_task): New procedure. * hurd/process_reply.defs (proc_set_init_task): Likewise. * hurd/process_request.defs (proc_set_init_task): Likewise. * include/pids.h: Add HURD_PID_INIT as 1, adjust others accordingly. * init/init.c (start_child): Register the child task. * proc/proc.h (init_proc): New variable. (create_startup_proc): Rename to create_init_proc. * proc/main.c (main): Create placeholder proc object for pid 1. * proc/mgt.c: Use init_proc instead of startup_proc, as the former is the new root of the process tree. (create_startup_proc): Rename to create_init_proc. (S_proc_set_init_task): New function. * doc/hurd.texi (Server Bootstrap): Update accordingly. * procfs/main.c: Do not hard-code kernel pid, use pids.h instead. --- procfs/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'procfs') diff --git a/procfs/main.c b/procfs/main.c index a620ba1c..629c8490 100644 --- a/procfs/main.c +++ b/procfs/main.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "procfs.h" #include "proclist.h" #include "rootdir.h" @@ -42,7 +43,7 @@ uid_t opt_anon_owner; #define OPT_CLK_TCK sysconf(_SC_CLK_TCK) #define OPT_STAT_MODE 0400 #define OPT_FAKE_SELF -1 -#define OPT_KERNEL_PID 2 +#define OPT_KERNEL_PID HURD_PID_KERNEL #define OPT_ANON_OWNER 0 #define NODEV_KEY -1 /* <= 0, so no short option. */ @@ -137,6 +138,8 @@ argp_parser (int key, char *arg, struct argp_state *state) } struct argp_option common_options[] = { +#define STR(X) XSTR (X) +#define XSTR(X) #X { "clk-tck", 'h', "HZ", 0, "Unit used for the values expressed in system clock ticks " "(default: sysconf(_SC_CLK_TCK))" }, @@ -153,7 +156,7 @@ struct argp_option common_options[] = { { "kernel-process", 'k', "PID", 0, "Process identifier for the kernel, used to retreive its command " "line, as well as the global up and idle times. " - "(default: 2)" }, + "(default: " STR (OPT_KERNEL_PID) ")" }, { "compatible", 'c', NULL, 0, "Try to be compatible with the Linux procps utilities. " "Currently equivalent to -h 100 -s 0444 -S 1." }, @@ -169,6 +172,8 @@ struct argp_option common_options[] = { { "nosuid", NOSUID_KEY, NULL, 0, "Ignored for compatibility with Linux' procfs." }, {} +#undef XSTR +#undef STR }; struct argp argp = { -- cgit v1.2.3