diff options
author | dyson <dyson@FreeBSD.org> | 1995-10-23 03:49:43 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1995-10-23 03:49:43 +0000 |
commit | eca6c1d9071f4f2d6fd60abc77434cb5c8c704f6 (patch) | |
tree | a4c5c0e3896279ce0d055bda78065aad34770917 /sys/vm/vm_mmap.c | |
parent | 770c343ca51517e46d159086b34446ef17252027 (diff) | |
download | FreeBSD-src-eca6c1d9071f4f2d6fd60abc77434cb5c8c704f6.zip FreeBSD-src-eca6c1d9071f4f2d6fd60abc77434cb5c8c704f6.tar.gz |
First phase of removing the PG_COPYONWRITE flag, and an architectural
cleanup of mapping files.
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r-- | sys/vm/vm_mmap.c | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index fb955fe..fed73e0 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -38,7 +38,7 @@ * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$ * * @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94 - * $Id: vm_mmap.c,v 1.26 1995/07/13 08:48:31 davidg Exp $ + * $Id: vm_mmap.c,v 1.27 1995/10/21 17:42:28 dyson Exp $ */ /* @@ -636,50 +636,31 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff) if (object == NULL) return (type == OBJT_DEVICE ? EINVAL : ENOMEM); - /* - * Anonymous memory, shared file, or character special file. - */ - if ((flags & (MAP_ANON|MAP_SHARED)) || (type == OBJT_DEVICE)) { - rv = vm_map_find(map, object, foff, addr, size, fitit); - if (rv != KERN_SUCCESS) { - /* - * Lose the object reference. Will destroy the - * object if it's an unnamed anonymous mapping - * or named anonymous without other references. - */ - vm_object_deallocate(object); - goto out; - } + rv = vm_map_find(map, object, foff, addr, size, fitit); + if (rv != KERN_SUCCESS) { + /* + * Lose the object reference. Will destroy the + * object if it's an unnamed anonymous mapping + * or named anonymous without other references. + */ + vm_object_deallocate(object); + goto out; } + /* * mmap a COW regular file */ - else { + if ((flags & (MAP_ANON|MAP_SHARED)) == 0 && (type != OBJT_DEVICE)) { vm_map_entry_t entry; - vm_object_t private_object; - - /* - * Create a new object and make the original object - * the backing object. NOTE: the object reference gained - * above is now changed into the reference held by - * private_object. Since we don't map 'object', we want - * only this one reference. - */ - private_object = vm_object_allocate(OBJT_DEFAULT, object->size); - private_object->backing_object = object; - TAILQ_INSERT_TAIL(&object->shadow_head, - private_object, shadow_list); - - rv = vm_map_find(map, private_object, foff, addr, size, fitit); - if (rv != KERN_SUCCESS) { - vm_object_deallocate(private_object); - goto out; - } - if (!vm_map_lookup_entry(map, *addr, &entry)) { panic("vm_mmap: missing map entry!!!"); } entry->copy_on_write = TRUE; + /* + * This will create the processes private object on + * an as needed basis. + */ + entry->needs_copy = TRUE; /* * set pages COW and protect for read access only |