MCPcopy Create free account
hub / github.com/F-Stack/f-stack / p_canwait

Function p_canwait

freebsd/kern/kern_prot.c:1807–1827  ·  view source on GitHub ↗

- * Determine whether td can wait for the exit of p. * Returns: 0 for permitted, an errno value otherwise * Locks: Sufficient locks to protect various components of td and p * must be held. td must be curthread, and a lock must * be held for p. * References: td and p must be valid for the lifetime of the call */

Source from the content-addressed store, hash-verified

1805
1806 */
1807int
1808p_canwait(struct thread *td, struct proc *p)
1809{
1810 int error;
1811
1812 KASSERT(td == curthread, ("%s: td not curthread", __func__));
1813 PROC_LOCK_ASSERT(p, MA_OWNED);
1814 if ((error = prison_check(td->td_ucred, p->p_ucred)))
1815 return (error);
1816#ifdef MAC
1817 if ((error = mac_proc_check_wait(td->td_ucred, p)))
1818 return (error);
1819#endif
1820#if 0
1821 /* XXXMAC: This could have odd effects on some shells. */
1822 if ((error = cr_canseeotheruids(td->td_ucred, p->p_ucred)))
1823 return (error);
1824#endif
1825
1826 return (0);
1827}
1828
1829/*
1830 * Credential management.

Callers 1

proc_to_reapFunction · 0.85

Calls 3

prison_checkFunction · 0.85
mac_proc_check_waitFunction · 0.85
cr_canseeotheruidsFunction · 0.85

Tested by

no test coverage detected