oops. forgot the patch. ;)

-- 
Alexander Best
Index: sys/vm/vm_mmap.c
===================================================================
--- sys/vm/vm_mmap.c    (revision 205390)
+++ sys/vm/vm_mmap.c    (working copy)
@@ -241,19 +241,23 @@
                    ((prot & (PROT_READ | PROT_WRITE)) != (PROT_READ | 
PROT_WRITE)))
                        return (EINVAL);
                flags |= MAP_ANON;
-               pos = 0;
        }
 
-       /*
-        * Align the file position to a page boundary,
-        * and save its page offset component.
-        */
-       pageoff = (pos & PAGE_MASK);
-       pos -= pageoff;
+       /* If MAP_ANON has been set the offset argument is being discarded. */
+       if (flags & MAP_ANON) {
+               pageoff = pos = 0;
+       } else {
+               /*
+                * Align the file position to a page boundary,
+                * and save its page offset component.
+                */
+               pageoff = (pos & PAGE_MASK);
+               pos -= pageoff;
 
-       /* Adjust size for rounding (on both ends). */
-       size += pageoff;                        /* low end... */
-       size = (vm_size_t) round_page(size);    /* hi end */
+               /* Adjust size for rounding (on both ends). */
+               size += pageoff;                        /* low end... */
+               size = (vm_size_t) round_page(size);    /* hi end */
+       }
 
        /*
         * Check for illegal addresses.  Watch out for address wrap... Note
@@ -300,7 +304,6 @@
                handle = NULL;
                handle_type = OBJT_DEFAULT;
                maxprot = VM_PROT_ALL;
-               pos = 0;
        } else {
                /*
                 * Mapping file, get fp for validation and
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to