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

Function shm_chmod

freebsd/kern/uipc_shm.c:1617–1644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1615}
1616
1617static int
1618shm_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
1619 struct thread *td)
1620{
1621 struct shmfd *shmfd;
1622 int error;
1623
1624 error = 0;
1625 shmfd = fp->f_data;
1626 mtx_lock(&shm_timestamp_lock);
1627 /*
1628 * SUSv4 says that x bits of permission need not be affected.
1629 * Be consistent with our shm_open there.
1630 */
1631#ifdef MAC
1632 error = mac_posixshm_check_setmode(active_cred, shmfd, mode);
1633 if (error != 0)
1634 goto out;
1635#endif
1636 error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid,
1637 VADMIN, active_cred);
1638 if (error != 0)
1639 goto out;
1640 shmfd->shm_mode = mode & ACCESSPERMS;
1641out:
1642 mtx_unlock(&shm_timestamp_lock);
1643 return (error);
1644}
1645
1646static int
1647shm_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,

Callers

nothing calls this directly

Calls 4

vaccessFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected