| 100 | SDT_PROBE_DEFINE1(proc, , , exit, "int"); |
| 101 | |
| 102 | struct proc * |
| 103 | proc_realparent(struct proc *child) |
| 104 | { |
| 105 | struct proc *p, *parent; |
| 106 | |
| 107 | sx_assert(&proctree_lock, SX_LOCKED); |
| 108 | if ((child->p_treeflag & P_TREE_ORPHANED) == 0) |
| 109 | return (child->p_pptr->p_pid == child->p_oppid ? |
| 110 | child->p_pptr : child->p_reaper); |
| 111 | for (p = child; (p->p_treeflag & P_TREE_FIRST_ORPHAN) == 0;) { |
| 112 | /* Cannot use LIST_PREV(), since the list head is not known. */ |
| 113 | p = __containerof(p->p_orphan.le_prev, struct proc, |
| 114 | p_orphan.le_next); |
| 115 | KASSERT((p->p_treeflag & P_TREE_ORPHANED) != 0, |
| 116 | ("missing P_ORPHAN %p", p)); |
| 117 | } |
| 118 | parent = __containerof(p->p_orphan.le_prev, struct proc, |
| 119 | p_orphans.lh_first); |
| 120 | return (parent); |
| 121 | } |
| 122 | |
| 123 | void |
| 124 | reaper_abandon_children(struct proc *p, bool exiting) |
no outgoing calls
no test coverage detected