-/* $OpenBSD: kern_exit.c,v 1.236 2024/10/08 11:57:59 claudio Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.237 2024/10/08 12:02:24 claudio Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
*/
while ((qr = LIST_FIRST(&pr->ps_orphans)) != NULL) {
mtx_enter(&qr->ps_mtx);
- KASSERT(qr->ps_oppid == pr->ps_pid);
- qr->ps_oppid = 0;
+ KASSERT(qr->ps_opptr == pr);
+ qr->ps_opptr = NULL;
process_clear_orphan(qr);
mtx_leave(&qr->ps_mtx);
}
* we need to give it back to the old parent.
*/
mtx_enter(&pr->ps_mtx);
- if (pr->ps_oppid != 0 && (pr->ps_oppid != pr->ps_ppid) &&
- (tr = prfind(pr->ps_oppid))) {
- pr->ps_oppid = 0;
+ if (pr->ps_opptr != NULL && (pr->ps_opptr != pr->ps_pptr)) {
+ tr = pr->ps_opptr;
+ pr->ps_opptr = NULL;
atomic_clearbits_int(&pr->ps_flags, PS_TRACED);
process_reparent(pr, tr);
mtx_leave(&pr->ps_mtx);
KASSERT(pr->ps_flags & PS_TRACED);
MUTEX_ASSERT_LOCKED(&pr->ps_mtx);
- if (pr->ps_oppid != 0 &&
- (pr->ps_oppid != pr->ps_ppid))
- ppr = prfind(pr->ps_oppid);
+ if (pr->ps_opptr != NULL &&
+ (pr->ps_opptr != pr->ps_pptr))
+ ppr = pr->ps_opptr;
/* not being traced any more */
- pr->ps_oppid = 0;
+ pr->ps_opptr = NULL;
atomic_clearbits_int(&pr->ps_flags, PS_TRACED);
process_reparent(pr, ppr ? ppr : initprocess);
}
if (child->ps_pptr == parent)
return;
- KASSERT(child->ps_oppid == 0 ||
- child->ps_oppid == child->ps_ppid);
+ KASSERT(child->ps_opptr == NULL ||
+ child->ps_opptr == child->ps_pptr);
LIST_REMOVE(child, ps_sibling);
LIST_INSERT_HEAD(&parent->ps_children, child, ps_sibling);
-/* $OpenBSD: kern_fork.c,v 1.266 2024/10/08 09:05:40 claudio Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.267 2024/10/08 12:02:24 claudio Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
mtx_enter(&pr->ps_mtx);
if (pr->ps_flags & PS_TRACED) {
- pr->ps_oppid = curpr->ps_pid;
+ pr->ps_opptr = curpr;
process_reparent(pr, curpr->ps_pptr);
/*
-/* $OpenBSD: sys_process.c,v 1.101 2024/10/08 09:05:40 claudio Exp $ */
+/* $OpenBSD: sys_process.c,v 1.102 2024/10/08 12:02:24 claudio Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
return EBUSY;
}
atomic_setbits_int(&tr->ps_flags, PS_TRACED);
- tr->ps_oppid = tr->ps_ppid;
+ tr->ps_opptr = tr->ps_pptr;
mtx_leave(&tr->ps_mtx);
if (tr->ps_ptstat == NULL)
tr->ps_ptstat = malloc(sizeof(*tr->ps_ptstat),
*/
mtx_enter(&tr->ps_mtx);
atomic_setbits_int(&tr->ps_flags, PS_TRACED);
- tr->ps_oppid = tr->ps_ppid;
+ tr->ps_opptr = tr->ps_pptr;
process_reparent(tr, p->p_p);
mtx_leave(&tr->ps_mtx);
if (tr->ps_ptstat == NULL)
-/* $OpenBSD: proc.h,v 1.373 2024/10/08 09:05:40 claudio Exp $ */
+/* $OpenBSD: proc.h,v 1.374 2024/10/08 12:02:24 claudio Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
int ps_xsig; /* Stopping or killing signal */
pid_t ps_ppid; /* [K|m] Cached parent pid */
- pid_t ps_oppid; /* [K|m] Old parent pid during ptrace */
int ps_ptmask; /* Ptrace event mask */
struct ptrace_state *ps_ptstat;/* Ptrace state */
+ struct process *ps_opptr; /* [K|m] Old parent during ptrace. */
struct rusage *ps_ru; /* sum of stats for dead threads. */
struct tusage ps_tu; /* [m] accumul times of dead threads. */