Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm In sys_mmap():



details:   https://anonhg.NetBSD.org/src/rev/87987f0efa60
branches:  trunk
changeset: 473740:87987f0efa60
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jun 17 21:05:19 1999 +0000

description:
In sys_mmap():
- rather than treating MAP_COPY like MAP_PRIVATE by sheer virtue of it not
  being MAP_SHARED, actually convert the MAP_COPY flag into MAP_PRIVATE.
- return EINVAL if MAP_SHARED and MAP_PRIVATE are both included in flags.

diffstat:

 sys/uvm/uvm_mmap.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 2221deac7eec -r 87987f0efa60 sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c        Thu Jun 17 19:33:36 1999 +0000
+++ b/sys/uvm/uvm_mmap.c        Thu Jun 17 21:05:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_mmap.c,v 1.23 1999/06/16 17:25:39 minoura Exp $    */
+/*     $NetBSD: uvm_mmap.c,v 1.24 1999/06/17 21:05:19 thorpej Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -335,6 +335,15 @@
        pos = SCARG(uap, pos);
 
        /*
+        * Fixup the old deprecated MAP_COPY into MAP_PRIVATE, and
+        * validate the flags.
+        */
+       if (flags & MAP_COPY)
+               flags = (flags & ~MAP_COPY) | MAP_PRIVATE;
+       if ((flags & (MAP_SHARED|MAP_PRIVATE)) == (MAP_SHARED|MAP_PRIVATE))
+               return (EINVAL);
+
+       /*
         * make sure that the newsize fits within a vaddr_t
         * XXX: need to revise addressing data types
         */
@@ -418,7 +427,7 @@
                 *
                 * XXX: how does MAP_ANON fit in the picture?
                 */
-               if ((flags & (MAP_SHARED|MAP_PRIVATE|MAP_COPY)) == 0) {
+               if ((flags & (MAP_SHARED|MAP_PRIVATE)) == 0) {
 #if defined(DEBUG)
                        printf("WARNING: defaulted mmap() share type to "
                           "%s (pid %d comm %s)\n", vp->v_type == VCHR ?
@@ -488,11 +497,13 @@
                handle = (caddr_t)vp;
 
        } else {                /* MAP_ANON case */
-
+               /*
+                * XXX What do we do about (MAP_SHARED|MAP_PRIVATE) == 0?
+                */
                if (fd != -1)
                        return (EINVAL);
 
-is_anon:               /* label for SunOS style /dev/zero */
+ is_anon:              /* label for SunOS style /dev/zero */
                handle = NULL;
                maxprot = VM_PROT_ALL;
                pos = 0;



Home | Main Index | Thread Index | Old Index