Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_shm.c
Show First 20 Lines • Show All 1,025 Lines • ▼ Show 20 Lines | #endif | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
int | int | ||||
kern_shm_open2(struct thread *td, const char *userpath, int flags, mode_t mode, | kern_shm_open2(struct thread *td, const char *userpath, int flags, mode_t mode, | ||||
int shmflags, struct filecaps *fcaps, const char *name __unused) | int shmflags, struct filecaps *fcaps, const char *name __unused) | ||||
{ | { | ||||
struct filedesc *fdp; | struct pathsdesc *pdp; | ||||
struct shmfd *shmfd; | struct shmfd *shmfd; | ||||
struct file *fp; | struct file *fp; | ||||
char *path; | char *path; | ||||
void *rl_cookie; | void *rl_cookie; | ||||
Fnv32_t fnv; | Fnv32_t fnv; | ||||
mode_t cmode; | mode_t cmode; | ||||
int error, fd, initial_seals; | int error, fd, initial_seals; | ||||
bool largepage; | bool largepage; | ||||
Show All 33 Lines | #endif | ||||
* taken below to ensure that the seals are properly set if the shmfd | * taken below to ensure that the seals are properly set if the shmfd | ||||
* already existed -- this currently assumes that only F_SEAL_SEAL can | * already existed -- this currently assumes that only F_SEAL_SEAL can | ||||
* be set and doesn't take further precautions to ensure the validity of | * be set and doesn't take further precautions to ensure the validity of | ||||
* the seals being added with respect to current mappings. | * the seals being added with respect to current mappings. | ||||
*/ | */ | ||||
if ((initial_seals & ~F_SEAL_SEAL) != 0) | if ((initial_seals & ~F_SEAL_SEAL) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
fdp = td->td_proc->p_fd; | pdp = td->td_proc->p_pd; | ||||
cmode = (mode & ~fdp->fd_cmask) & ACCESSPERMS; | cmode = (mode & ~pdp->pd_cmask) & ACCESSPERMS; | ||||
/* | /* | ||||
* shm_open(2) created shm should always have O_CLOEXEC set, as mandated | * shm_open(2) created shm should always have O_CLOEXEC set, as mandated | ||||
* by POSIX. We allow it to be unset here so that an in-kernel | * by POSIX. We allow it to be unset here so that an in-kernel | ||||
* interface may be written as a thin layer around shm, optionally not | * interface may be written as a thin layer around shm, optionally not | ||||
* setting CLOEXEC. For shm_open(2), O_CLOEXEC is set unconditionally | * setting CLOEXEC. For shm_open(2), O_CLOEXEC is set unconditionally | ||||
* in sys_shm_open() to keep this implementation compliant. | * in sys_shm_open() to keep this implementation compliant. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 886 Lines • Show Last 20 Lines |