summaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-25 22:13:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-25 22:13:47 +0000
commitd282def47ad33918e9dbb101237c2caceecd5642 (patch)
treee572cd7f000f6657c5cd8ccba9ea3f71531920e5 /sys/vm
parent6215edb23e105cb198c45eff9bb948627c21acb2 (diff)
check for zerodev special case before kicking out all VCHR cases
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_mmap.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 3d6ab555d69..625f8e9c82f 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_mmap.c,v 1.12 1998/02/19 22:00:27 niklas Exp $ */
+/* $OpenBSD: vm_mmap.c,v 1.13 1998/02/25 22:13:46 deraadt Exp $ */
/* $NetBSD: vm_mmap.c,v 1.47 1996/03/16 23:15:23 christos Exp $ */
/*
@@ -215,13 +215,6 @@ sys_mmap(p, v, retval)
vp = (struct vnode *)fp->f_data;
/*
- * Only files and cdevs are mappable, and cdevs does not
- * provide private mappings of any kind.
- */
- if (vp->v_type != VREG &&
- (vp->v_type != VCHR || (flags & (MAP_PRIVATE|MAP_COPY))))
- return (EINVAL);
- /*
* XXX hack to handle use of /dev/zero to map anon
* memory (ala SunOS).
*/
@@ -229,6 +222,14 @@ sys_mmap(p, v, retval)
flags |= MAP_ANON;
goto is_anon;
}
+
+ /*
+ * Only files and cdevs are mappable, and cdevs does not
+ * provide private mappings of any kind.
+ */
+ if (vp->v_type != VREG &&
+ (vp->v_type != VCHR || (flags & (MAP_PRIVATE|MAP_COPY))))
+ return (EINVAL);
/*
* Ensure that file and memory protections are
* compatible. Note that we only worry about