summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2007-04-03 08:05:43 +0000
committerart <art@openbsd.org>2007-04-03 08:05:43 +0000
commita4ad07927657aa251f50e5df57ea343715c21572 (patch)
tree28a2f6376d7143c7e6e3b709a936339f99da5fc6 /sys/kern/init_main.c
parenti have a bad habit of not documenting extra interfaces i add... (diff)
downloadwireguard-openbsd-a4ad07927657aa251f50e5df57ea343715c21572.tar.xz
wireguard-openbsd-a4ad07927657aa251f50e5df57ea343715c21572.zip
Start moving state that is shared among threads in a process into
a new struct. Instead of doing a huge rename and deal with the fallout for weeks, like other projects that need no mention, we will slowly and carefully move things out of struct proc into a new struct process. - Create struct process and the infrastructure to create and remove them. - Move threads in a process into struct process. deraadt@, tedu@ ok
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 291aa2e5a6a..01dd7faa856 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.137 2007/03/24 16:01:22 art Exp $ */
+/* $OpenBSD: init_main.c,v 1.138 2007/04/03 08:05:43 art Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -108,6 +108,7 @@ const char copyright[] =
struct session session0;
struct pgrp pgrp0;
struct proc proc0;
+struct process process0;
struct pcred cred0;
struct plimit limit0;
struct vmspace vmspace0;
@@ -258,6 +259,12 @@ main(void *framep)
/*
* Create process 0 (the swapper).
*/
+
+ process0.ps_mainproc = p;
+ TAILQ_INIT(&process0.ps_threads);
+ TAILQ_INSERT_TAIL(&process0.ps_threads, p, p_thr_link);
+ p->p_p = &process0;
+
LIST_INSERT_HEAD(&allproc, p, p_list);
p->p_pgrp = &pgrp0;
LIST_INSERT_HEAD(PIDHASH(0), p, p_hash);
@@ -269,9 +276,6 @@ main(void *framep)
session0.s_count = 1;
session0.s_leader = p;
- p->p_thrparent = p;
- LIST_INIT(&p->p_thrchildren);
-
atomic_setbits_int(&p->p_flag, P_SYSTEM | P_NOCLDWAIT);
p->p_stat = SONPROC;
p->p_nice = NZERO;