summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2000-04-22 15:22:31 +0000
committerwollman <wollman@FreeBSD.org>2000-04-22 15:22:31 +0000
commit16604ab260bd5c8c562cf5d28e190a84abd6ce84 (patch)
tree87dc595b565cb212c33ff9db0bf23c457e1c1b03 /sys/vm/vm_mmap.c
parent0a69363705f7f23b90ad08f0508d249d76df3da0 (diff)
downloadFreeBSD-src-16604ab260bd5c8c562cf5d28e190a84abd6ce84.zip
FreeBSD-src-16604ab260bd5c8c562cf5d28e190a84abd6ce84.tar.gz
Implement POSIX.1b shared memory objects. In this implementation,
shared memory objects are regular files; the shm_open(3) routine uses fcntl(2) to set a flag on the descriptor which tells mmap(2) to automatically apply MAP_NOSYNC. Not objected to by: bde, dillon, dufault, jasone
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r--sys/vm/vm_mmap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 53462f4..d617d0c 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -282,6 +282,16 @@ mmap(p, uap)
return (EBADF);
if (fp->f_type != DTYPE_VNODE)
return (EINVAL);
+ /*
+ * POSIX shared-memory objects are defined to have
+ * kernel persistence, and are not defined to support
+ * read(2)/write(2) -- or even open(2). Thus, we can
+ * use MAP_ASYNC to trade on-disk coherence for speed.
+ * The shm_open(3) library routine turns on the FPOSIXSHM
+ * flag to request this behavior.
+ */
+ if (fp->f_flag & FPOSIXSHM)
+ flags |= MAP_NOSYNC;
vp = (struct vnode *) fp->f_data;
if (vp->v_type != VREG && vp->v_type != VCHR)
return (EINVAL);
OpenPOWER on IntegriCloud