summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_procctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_procctl.c')
-rw-r--r--sys/kern/kern_procctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c
index 5c4b40d..734c871 100644
--- a/sys/kern/kern_procctl.c
+++ b/sys/kern/kern_procctl.c
@@ -160,7 +160,7 @@ static int
reap_status(struct thread *td, struct proc *p,
struct procctl_reaper_status *rs)
{
- struct proc *reap, *p2;
+ struct proc *reap, *p2, *first_p;
sx_assert(&proctree_lock, SX_LOCKED);
bzero(rs, sizeof(*rs));
@@ -176,8 +176,10 @@ reap_status(struct thread *td, struct proc *p,
rs->rs_descendants = 0;
rs->rs_children = 0;
if (!LIST_EMPTY(&reap->p_reaplist)) {
- KASSERT(!LIST_EMPTY(&reap->p_children), ("no children"));
- rs->rs_pid = LIST_FIRST(&reap->p_children)->p_pid;
+ first_p = LIST_FIRST(&reap->p_children);
+ if (first_p == NULL)
+ first_p = LIST_FIRST(&reap->p_reaplist);
+ rs->rs_pid = first_p->p_pid;
LIST_FOREACH(p2, &reap->p_reaplist, p_reapsibling) {
if (proc_realparent(p2) == reap)
rs->rs_children++;
OpenPOWER on IntegriCloud