diff options
author | 2020-03-16 11:58:46 +0000 | |
---|---|---|
committer | 2020-03-16 11:58:46 +0000 | |
commit | 8fb2af3abc3ad848e70f6ddec0c3b4bd7f12e036 (patch) | |
tree | 695b499af4ba9de7ebfc09b409b5258a23094122 /sys/kern/kern_fork.c | |
parent | VTE treats each mouse mode bit as independent, so turning off 1000 (diff) | |
download | wireguard-openbsd-8fb2af3abc3ad848e70f6ddec0c3b4bd7f12e036.tar.xz wireguard-openbsd-8fb2af3abc3ad848e70f6ddec0c3b4bd7f12e036.zip |
Keep track of traced child under a list of orphans while they are being
reparented to a debugger process.
Also re-parent exiting traced processes to their original parent, if it
is still alive, after the debugger has seen the exit status.
Logic comes from FreeBSD pointed out by guenther@.
While here rename proc_reparent() into process_reparent() and get rid of
superfluous checks.
ok visa@
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 613ec3c8d8f..71129dd4079 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.223 2020/02/21 11:10:23 claudio Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.224 2020/03/16 11:58:46 mpi Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -190,6 +190,7 @@ process_initialize(struct process *pr, struct proc *p) KASSERT(p->p_ucred->cr_ref >= 2); /* new thread and new process */ LIST_INIT(&pr->ps_children); + LIST_INIT(&pr->ps_orphans); LIST_INIT(&pr->ps_ftlist); LIST_INIT(&pr->ps_sigiolst); TAILQ_INIT(&pr->ps_tslpqueue); @@ -430,8 +431,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg, if (pr->ps_flags & PS_TRACED) { pr->ps_oppid = curpr->ps_pid; - if (pr->ps_pptr != curpr->ps_pptr) - proc_reparent(pr, curpr->ps_pptr); + process_reparent(pr, curpr->ps_pptr); /* * Set ptrace status. |