diff options
| author | 2010-07-26 01:56:27 +0000 | |
|---|---|---|
| committer | 2010-07-26 01:56:27 +0000 | |
| commit | 207e4b38a785bf665de26471f4fc5fde67fa99f0 (patch) | |
| tree | 5b61a93df6c22438e6a0955afca220cb2f2207a0 /sys/kern/init_main.c | |
| parent | Add missing braces so a loop will function as intended. (diff) | |
| download | wireguard-openbsd-207e4b38a785bf665de26471f4fc5fde67fa99f0.tar.xz wireguard-openbsd-207e4b38a785bf665de26471f4fc5fde67fa99f0.zip | |
Correct the links between threads, processes, pgrps, and sessions,
so that the process-level stuff is to/from struct process and not
struct proc. This fixes a bunch of problem cases in rthreads.
Based on earlier work by blambert and myself, but mostly written
at c2k10.
Tested by many: deraadt, sthen, krw, ray, and in snapshots
Diffstat (limited to 'sys/kern/init_main.c')
| -rw-r--r-- | sys/kern/init_main.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index e3d5d4c3ee2..14afa2af599 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.169 2010/07/03 04:44:51 guenther Exp $ */ +/* $OpenBSD: init_main.c,v 1.170 2010/07/26 01:56:27 guenther Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -184,6 +184,7 @@ int main(void *framep) { struct proc *p; + struct process *pr; struct pdevinit *pdev; struct timeval rtv; quad_t lim; @@ -263,21 +264,21 @@ main(void *framep) TAILQ_INIT(&process0.ps_threads); TAILQ_INSERT_TAIL(&process0.ps_threads, p, p_thr_link); process0.ps_refcnt = 1; - p->p_p = &process0; + p->p_p = pr = &process0; /* Set the default routing table/domain. */ process0.ps_rtableid = 0; LIST_INSERT_HEAD(&allproc, p, p_list); - p->p_pgrp = &pgrp0; + pr->ps_pgrp = &pgrp0; LIST_INSERT_HEAD(PIDHASH(0), p, p_hash); LIST_INSERT_HEAD(PGRPHASH(0), &pgrp0, pg_hash); LIST_INIT(&pgrp0.pg_members); - LIST_INSERT_HEAD(&pgrp0.pg_members, p, p_pglist); + LIST_INSERT_HEAD(&pgrp0.pg_members, pr, ps_pglist); pgrp0.pg_session = &session0; session0.s_count = 1; - session0.s_leader = p; + session0.s_leader = pr; atomic_setbits_int(&p->p_flag, P_SYSTEM | P_NOCLDWAIT); p->p_stat = SONPROC; @@ -303,7 +304,7 @@ main(void *framep) p->p_fd = fdinit(NULL); /* Create the limits structures. */ - p->p_p->ps_limit = &limit0; + pr->ps_limit = &limit0; for (i = 0; i < nitems(p->p_rlimit); i++) limit0.pl_rlimit[i].rlim_cur = limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY; |
