Page MenuHomeFreeBSD

D21119.id60306.diff
No OneTemporary

D21119.id60306.diff

Index: sys/kern/uipc_shm.c
===================================================================
--- sys/kern/uipc_shm.c
+++ sys/kern/uipc_shm.c
@@ -729,7 +729,14 @@
fdp = td->td_proc->p_fd;
cmode = (mode & ~fdp->fd_cmask) & ACCESSPERMS;
- error = falloc_caps(td, &fp, &fd, O_CLOEXEC, fcaps);
+ /*
+ * 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
+ * interface may be written as a thin layer around shm, optionally not
+ * setting CLOEXEC. For shm_open(2), O_CLOEXEC is set unconditionally
+ * in sys_shm_open to keep this implementation compliant.
+ */
+ error = falloc_caps(td, &fp, &fd, flags & O_CLOEXEC, fcaps);
if (error)
return (error);
@@ -844,7 +851,8 @@
sys_shm_open(struct thread *td, struct shm_open_args *uap)
{
- return (kern_shm_open(td, uap->path, uap->flags, uap->mode, NULL));
+ return (kern_shm_open(td, uap->path, uap->flags | O_CLOEXEC, uap->mode,
+ NULL));
}
int

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 18, 9:12 AM (3 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35193808
Default Alt Text
D21119.id60306.diff (1005 B)

Event Timeline