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

Function sem_prison_check

freebsd/kern/sysv_sem.c:1553–1586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1551}
1552
1553static int
1554sem_prison_check(void *obj, void *data)
1555{
1556 struct prison *pr = obj;
1557 struct prison *prpr;
1558 struct vfsoptlist *opts = data;
1559 int error, jsys;
1560
1561 /*
1562 * sysvsem is a jailsys integer.
1563 * It must be "disable" if the parent jail is disabled.
1564 */
1565 error = vfs_copyopt(opts, "sysvsem", &jsys, sizeof(jsys));
1566 if (error != ENOENT) {
1567 if (error != 0)
1568 return (error);
1569 switch (jsys) {
1570 case JAIL_SYS_DISABLE:
1571 break;
1572 case JAIL_SYS_NEW:
1573 case JAIL_SYS_INHERIT:
1574 prison_lock(pr->pr_parent);
1575 prpr = osd_jail_get(pr->pr_parent, sem_prison_slot);
1576 prison_unlock(pr->pr_parent);
1577 if (prpr == NULL)
1578 return (EPERM);
1579 break;
1580 default:
1581 return (EINVAL);
1582 }
1583 }
1584
1585 return (0);
1586}
1587
1588static int
1589sem_prison_set(void *obj, void *data)

Callers

nothing calls this directly

Calls 3

vfs_copyoptFunction · 0.85
prison_lockFunction · 0.85
prison_unlockFunction · 0.85

Tested by

no test coverage detected