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

Function mqfs_prison_remove

freebsd/kern/uipc_mqueue.c:1561–1591  ·  view source on GitHub ↗

* See if this prison root is obsolete, and clean up associated queues if it is. */

Source from the content-addressed store, hash-verified

1559 * See if this prison root is obsolete, and clean up associated queues if it is.
1560 */
1561static int
1562mqfs_prison_remove(void *obj, void *data __unused)
1563{
1564 const struct prison *pr = obj;
1565 struct prison *tpr;
1566 struct mqfs_node *pn, *tpn;
1567 int found;
1568
1569 found = 0;
1570 TAILQ_FOREACH(tpr, &allprison, pr_list) {
1571 prison_lock(tpr);
1572 if (tpr != pr && prison_isvalid(tpr) &&
1573 tpr->pr_root == pr->pr_root)
1574 found = 1;
1575 prison_unlock(tpr);
1576 }
1577 if (!found) {
1578 /*
1579 * No jails are rooted in this directory anymore,
1580 * so no queues should be either.
1581 */
1582 sx_xlock(&mqfs_data.mi_lock);
1583 LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children,
1584 mn_sibling, tpn) {
1585 if (pn->mn_pr_root == pr->pr_root)
1586 (void)do_unlink(pn, curthread->td_ucred);
1587 }
1588 sx_xunlock(&mqfs_data.mi_lock);
1589 }
1590 return (0);
1591}
1592
1593/*
1594 * Allocate a message queue

Callers

nothing calls this directly

Calls 4

prison_lockFunction · 0.85
prison_isvalidFunction · 0.85
prison_unlockFunction · 0.85
do_unlinkFunction · 0.85

Tested by

no test coverage detected