Index: sys/kern/kern_proc.c =================================================================== --- sys/kern/kern_proc.c +++ sys/kern/kern_proc.c @@ -866,7 +866,7 @@ if (isjobproc(jobc_parent(p), pgrp)) pgadjustjobc(pgrp, true); LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) + if (jobc_parent(q) != p) continue; fixjobc_enterpgrp_q(pgrp, p, q, true); } @@ -876,7 +876,7 @@ if (isjobproc(jobc_parent(p), p->p_pgrp)) pgadjustjobc(p->p_pgrp, false); LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) + if (jobc_parent(q) != p) continue; fixjobc_enterpgrp_q(pgrp, p, q, false); } @@ -937,14 +937,14 @@ * adjust counts for children's process groups. */ LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) + if (jobc_parent(q) != p) continue; fixjobc_kill_q(p, q, true); } LIST_FOREACH(q, &p->p_orphans, p_orphan) fixjobc_kill_q(p, q, true); LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) + if (jobc_parent(q) != p) continue; fixjobc_kill_q(p, q, false); }