Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/shm_open.c
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | if ((flags & MFD_HUGE_MASK) != 0 && (flags & MFD_HUGETLB) == 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
/* We don't actually support HUGETLB. */ | /* We don't actually support HUGETLB. */ | ||||
if ((flags & MFD_HUGETLB) != 0) | if ((flags & MFD_HUGETLB) != 0) | ||||
return (ENOSYS); | return (ENOSYS); | ||||
/* We've already validated that we're sufficiently sized. */ | /* We've already validated that we're sufficiently sized. */ | ||||
snprintf(memfd_name, NAME_MAX + 1, "%s%s", MEMFD_NAME_PREFIX, name); | snprintf(memfd_name, NAME_MAX + 1, "%s%s", MEMFD_NAME_PREFIX, name); | ||||
oflags = O_RDWR; | oflags = O_RDWR; | ||||
shmflags = 0; | shmflags = SHM_GROW_ON_WRITE; | ||||
if ((flags & MFD_CLOEXEC) != 0) | if ((flags & MFD_CLOEXEC) != 0) | ||||
oflags |= O_CLOEXEC; | oflags |= O_CLOEXEC; | ||||
if ((flags & MFD_ALLOW_SEALING) != 0) | if ((flags & MFD_ALLOW_SEALING) != 0) | ||||
shmflags |= SHM_ALLOW_SEALING; | shmflags |= SHM_ALLOW_SEALING; | ||||
return (__sys_shm_open2(SHM_ANON, oflags, 0, shmflags, memfd_name)); | return (__sys_shm_open2(SHM_ANON, oflags, 0, shmflags, memfd_name)); | ||||
} | } |