diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2013-07-26 16:38:29 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-08-28 23:26:39 +0200 |
commit | 193cef0bdcc7b4a7e06a6cf30e96684c9f454863 (patch) | |
tree | 54eb66507f920a6690f9fca765f4633cc585ccc7 | |
parent | 9b3a87f37c4e829386ceb10de974d409a31adcf7 (diff) |
Define and use symbolic names for important processes
* include/pids.h: New file.
* init/init.c (frob_kernel_process): Use symbolic name for kernel process.
* exec/exec.c (S_exec_init): Use symbolic name for startup process.
* libdiskfs/boot-start.c (diskfs_S_fsys_init): Likewise.
* libdiskfs/init-startup.c (_diskfs_init_completed): Likewise.
* pfinet/main.c (arrange_shutdown_notification): Likewise.
* proc/mgt.c (create_startup_proc): Likewise.
* proc/main.c (main): Use symbolic name for proc process.
-rw-r--r-- | exec/main.c | 3 | ||||
-rw-r--r-- | include/pids.h | 29 | ||||
-rw-r--r-- | init/init.c | 3 | ||||
-rw-r--r-- | libdiskfs/boot-start.c | 3 | ||||
-rw-r--r-- | libdiskfs/init-startup.c | 3 | ||||
-rw-r--r-- | pfinet/main.c | 3 | ||||
-rw-r--r-- | proc/main.c | 3 | ||||
-rw-r--r-- | proc/mgt.c | 3 |
8 files changed, 43 insertions, 7 deletions
diff --git a/exec/main.c b/exec/main.c index efad85aa..d5d6882a 100644 --- a/exec/main.c +++ b/exec/main.c @@ -25,6 +25,7 @@ #include <hurd/startup.h> #include <argp.h> #include <version.h> +#include <pids.h> const char *argp_program_version = STANDARD_HURD_VERSION (exec); @@ -246,7 +247,7 @@ S_exec_init (struct trivfs_protid *protid, proc_register_version (procserver, host_priv, "exec", "", HURD_VERSION); - err = proc_getmsgport (procserver, 1, &startup); + err = proc_getmsgport (procserver, HURD_PID_STARTUP, &startup); assert_perror (err); mach_port_deallocate (mach_task_self (), procserver); diff --git a/include/pids.h b/include/pids.h new file mode 100644 index 00000000..485916b5 --- /dev/null +++ b/include/pids.h @@ -0,0 +1,29 @@ +/* List of special processes. + + Copyright (C) 2013 Free Software Foundation + Written by Justus Winter <4winter@informatik.uni-hamburg.de> + + This file is part of the GNU Hurd. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _HURD_PROCESSES_H +#define _HURD_PROCESSES_H + +#define HURD_PID_PROC 0 +#define HURD_PID_STARTUP 1 +#define HURD_PID_KERNEL 2 + +#endif /* _HURD_PROCESSES_H */ diff --git a/init/init.c b/init/init.c index 930408e8..05fce78f 100644 --- a/init/init.c +++ b/init/init.c @@ -49,6 +49,7 @@ #include <maptime.h> #include <version.h> #include <argp.h> +#include <pids.h> #include "startup_notify_U.h" #include "startup_reply_U.h" @@ -770,7 +771,7 @@ frob_kernel_process (void) task_t task; process_t proc, kbs; - err = proc_pid2task (procserver, 2, &task); + err = proc_pid2task (procserver, HURD_PID_KERNEL, &task); if (err) { error (0, err, "cannot get kernel task port"); diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c index b62d5f30..6d9a7734 100644 --- a/libdiskfs/boot-start.c +++ b/libdiskfs/boot-start.c @@ -33,6 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> #include <argz.h> #include <error.h> +#include <pids.h> #include "fsys_S.h" #include "fsys_reply_U.h" @@ -606,7 +607,7 @@ diskfs_S_fsys_init (mach_port_t port, proc_register_version (procserver, host, diskfs_server_name, "", diskfs_server_version); - err = proc_getmsgport (procserver, 1, &startup); + err = proc_getmsgport (procserver, HURD_PID_STARTUP, &startup); if (!err) { startup_essential_task (startup, mach_task_self (), MACH_PORT_NULL, diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c index 2c0814fd..ff1622f0 100644 --- a/libdiskfs/init-startup.c +++ b/libdiskfs/init-startup.c @@ -26,6 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <error.h> #include <hurd/fsys.h> #include <hurd/startup.h> +#include <pids.h> char *_diskfs_chroot_directory; @@ -190,7 +191,7 @@ _diskfs_init_completed () if (err) goto errout; - err = proc_getmsgport (proc, 1, &init); + err = proc_getmsgport (proc, HURD_PID_STARTUP, &init); mach_port_deallocate (mach_task_self (), proc); if (err) goto errout; diff --git a/pfinet/main.c b/pfinet/main.c index 01b324df..c9527195 100644 --- a/pfinet/main.c +++ b/pfinet/main.c @@ -28,6 +28,7 @@ #include <string.h> #include <fcntl.h> #include <version.h> +#include <pids.h> /* Include Hurd's errno.h file, but don't include glue-include/hurd/errno.h, since it #undef's the errno macro. */ @@ -153,7 +154,7 @@ arrange_shutdown_notification () if (!procserver) return; - err = proc_getmsgport (procserver, 1, &initport); + err = proc_getmsgport (procserver, HURD_PID_STARTUP, &initport); mach_port_deallocate (mach_task_self (), procserver); if (err) return; diff --git a/proc/main.c b/proc/main.c index 494169e7..73abbc07 100644 --- a/proc/main.c +++ b/proc/main.c @@ -28,6 +28,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <argp.h> #include <error.h> #include <version.h> +#include <pids.h> #include "proc.h" @@ -87,7 +88,7 @@ main (int argc, char **argv, char **envp) self_proc = allocate_proc (mach_task_self ()); assert (self_proc); - complete_proc (self_proc, 0); + complete_proc (self_proc, HURD_PID_PROC); startup_port = ports_get_send_right (startup_proc); err = startup_procinit (boot, startup_port, &startup_proc->p_task, @@ -32,6 +32,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <sys/resource.h> #include <hurd/auth.h> #include <assert.h> +#include <pids.h> #include "proc.h" #include "process_S.h" @@ -582,7 +583,7 @@ create_startup_proc (void) p = allocate_proc (MACH_PORT_NULL); assert (p); - p->p_pid = 1; + p->p_pid = HURD_PID_STARTUP; p->p_parent = p; p->p_sib = 0; |