diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2010-07-26 01:56:28 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2010-07-26 01:56:28 +0000 |
commit | 12738501a521de949783a0ef772f333a85a28079 (patch) | |
tree | a8d79b5579bc5fb4f0fe053219d7da149a912112 /sys/kern/sys_process.c | |
parent | 58397ea88d58979fc9e046dc9c64692785b924ae (diff) |
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/sys_process.c')
-rw-r--r-- | sys/kern/sys_process.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index d3944c41811..e38e673e7e5 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_process.c,v 1.46 2010/06/26 23:24:45 guenther Exp $ */ +/* $OpenBSD: sys_process.c,v 1.47 2010/07/26 01:56:27 guenther Exp $ */ /* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */ /*- @@ -172,7 +172,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) * not init (because that would create a loop in * the process graph). */ - if (t->p_pid != 1 && inferior(p, t)) + if (t->p_pid != 1 && inferior(p->p_p, t->p_p)) return (EINVAL); break; @@ -217,7 +217,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) /* * (2) it's not being traced by _you_, or */ - if (t->p_pptr != p) + if (t->p_p->ps_pptr != p->p_p) return (EBUSY); /* @@ -242,7 +242,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) case PT_TRACE_ME: /* Just set the trace flag. */ atomic_setbits_int(&t->p_flag, P_TRACED); - t->p_oppid = t->p_pptr->p_pid; + t->p_oppid = t->p_p->ps_pptr->ps_pid; if (t->p_ptstat == NULL) t->p_ptstat = malloc(sizeof(*t->p_ptstat), M_SUBPROC, M_WAITOK); @@ -387,11 +387,11 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) #endif /* give process back to original parent or init */ - if (t->p_oppid != t->p_pptr->p_pid) { - struct proc *pp; + if (t->p_oppid != t->p_p->ps_pptr->ps_pid) { + struct process *ppr; - pp = pfind(t->p_oppid); - proc_reparent(t, pp ? pp : initproc); + ppr = prfind(t->p_oppid); + proc_reparent(t->p_p, ppr ? ppr : initproc->p_p); } /* not being traced any more */ @@ -432,9 +432,9 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) * Stop the target. */ atomic_setbits_int(&t->p_flag, P_TRACED); - t->p_oppid = t->p_pptr->p_pid; - if (t->p_pptr != p) - proc_reparent(t, p); + t->p_oppid = t->p_p->ps_pptr->ps_pid; + if (t->p_p->ps_pptr != p->p_p) + proc_reparent(t->p_p, p->p_p); if (t->p_ptstat == NULL) t->p_ptstat = malloc(sizeof(*t->p_ptstat), M_SUBPROC, M_WAITOK); |