Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_proc.c
Show First 20 Lines • Show All 860 Lines • ▼ Show 20 Lines | fixjobc_enterpgrp(struct proc *p, struct pgrp *pgrp) | ||||
SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); | SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); | ||||
if (p->p_pgrp == pgrp) | if (p->p_pgrp == pgrp) | ||||
return; | return; | ||||
if (isjobproc(jobc_parent(p), pgrp)) | if (isjobproc(jobc_parent(p), pgrp)) | ||||
pgadjustjobc(pgrp, true); | pgadjustjobc(pgrp, true); | ||||
LIST_FOREACH(q, &p->p_children, p_sibling) { | LIST_FOREACH(q, &p->p_children, p_sibling) { | ||||
if ((q->p_treeflag & P_TREE_ORPHANED) != 0) | if (jobc_parent(q) != p) | ||||
continue; | continue; | ||||
fixjobc_enterpgrp_q(pgrp, p, q, true); | fixjobc_enterpgrp_q(pgrp, p, q, true); | ||||
} | } | ||||
LIST_FOREACH(q, &p->p_orphans, p_orphan) | LIST_FOREACH(q, &p->p_orphans, p_orphan) | ||||
fixjobc_enterpgrp_q(pgrp, p, q, true); | fixjobc_enterpgrp_q(pgrp, p, q, true); | ||||
if (isjobproc(jobc_parent(p), p->p_pgrp)) | if (isjobproc(jobc_parent(p), p->p_pgrp)) | ||||
pgadjustjobc(p->p_pgrp, false); | pgadjustjobc(p->p_pgrp, false); | ||||
LIST_FOREACH(q, &p->p_children, p_sibling) { | LIST_FOREACH(q, &p->p_children, p_sibling) { | ||||
if ((q->p_treeflag & P_TREE_ORPHANED) != 0) | if (jobc_parent(q) != p) | ||||
continue; | continue; | ||||
fixjobc_enterpgrp_q(pgrp, p, q, false); | fixjobc_enterpgrp_q(pgrp, p, q, false); | ||||
} | } | ||||
LIST_FOREACH(q, &p->p_orphans, p_orphan) | LIST_FOREACH(q, &p->p_orphans, p_orphan) | ||||
fixjobc_enterpgrp_q(pgrp, p, q, false); | fixjobc_enterpgrp_q(pgrp, p, q, false); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (isjobproc(jobc_parent(p), pgrp)) | ||||
pgadjustjobc(pgrp, false); | pgadjustjobc(pgrp, false); | ||||
/* | /* | ||||
* Check this process' children to see whether they qualify | * Check this process' children to see whether they qualify | ||||
* their process groups after reparenting to reaper. If so, | * their process groups after reparenting to reaper. If so, | ||||
* adjust counts for children's process groups. | * adjust counts for children's process groups. | ||||
*/ | */ | ||||
LIST_FOREACH(q, &p->p_children, p_sibling) { | LIST_FOREACH(q, &p->p_children, p_sibling) { | ||||
if ((q->p_treeflag & P_TREE_ORPHANED) != 0) | if (jobc_parent(q) != p) | ||||
continue; | continue; | ||||
fixjobc_kill_q(p, q, true); | fixjobc_kill_q(p, q, true); | ||||
} | } | ||||
LIST_FOREACH(q, &p->p_orphans, p_orphan) | LIST_FOREACH(q, &p->p_orphans, p_orphan) | ||||
fixjobc_kill_q(p, q, true); | fixjobc_kill_q(p, q, true); | ||||
LIST_FOREACH(q, &p->p_children, p_sibling) { | LIST_FOREACH(q, &p->p_children, p_sibling) { | ||||
if ((q->p_treeflag & P_TREE_ORPHANED) != 0) | if (jobc_parent(q) != p) | ||||
continue; | continue; | ||||
fixjobc_kill_q(p, q, false); | fixjobc_kill_q(p, q, false); | ||||
} | } | ||||
LIST_FOREACH(q, &p->p_orphans, p_orphan) | LIST_FOREACH(q, &p->p_orphans, p_orphan) | ||||
fixjobc_kill_q(p, q, false); | fixjobc_kill_q(p, q, false); | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
check_pgrp_jobc(pgrp); | check_pgrp_jobc(pgrp); | ||||
▲ Show 20 Lines • Show All 2,474 Lines • Show Last 20 Lines |