diff options
author | dg <dg@FreeBSD.org> | 1995-03-25 16:55:46 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-25 16:55:46 +0000 |
commit | 05c4d98f93dfed971fbeaf13c18dbbab396ae6b2 (patch) | |
tree | 1fd0d557802beb217bca6c0b848f0abb90b07272 /sys/vm | |
parent | f4c69165a1c8d1f1e2bc06aabbea2977288aee58 (diff) | |
download | FreeBSD-src-05c4d98f93dfed971fbeaf13c18dbbab396ae6b2.zip FreeBSD-src-05c4d98f93dfed971fbeaf13c18dbbab396ae6b2.tar.gz |
Added "flags" argument to msync, and implemented MS_ASYNC and MS_INVALIDATE.
The MS_ASYNC flag doesn't current work, and MS_INVALIDATE will only toss out
the pages in the address space (not all pages in the shadow chain).
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_mmap.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 12860fd..ed5d00a 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.17 1995/03/21 10:15:52 davidg Exp $ + * $Id: vm_mmap.c,v 1.18 1995/03/22 05:08:41 davidg Exp $ */ /* @@ -304,6 +304,7 @@ ommap(p, uap, retval) struct msync_args { caddr_t addr; int len; + int flags; }; int msync(p, uap, retval) @@ -313,9 +314,9 @@ msync(p, uap, retval) { vm_offset_t addr; vm_size_t size; + int flags; vm_map_t map; int rv; - boolean_t syncio, invalidate; #ifdef DEBUG if (mmapdebug & (MDB_FOLLOW | MDB_SYNC)) @@ -327,6 +328,8 @@ msync(p, uap, retval) map = &p->p_vmspace->vm_map; addr = (vm_offset_t) uap->addr; size = (vm_size_t) uap->len; + flags = uap->flags; + /* * XXX Gak! If size is zero we are supposed to sync "all modified * pages with the region containing addr". Unfortunately, we don't @@ -345,26 +348,19 @@ msync(p, uap, retval) addr = entry->start; size = entry->end - entry->start; } + #ifdef DEBUG if (mmapdebug & MDB_SYNC) printf("msync: cleaning/flushing address range [%x-%x)\n", addr, addr + size); #endif - /* - * Could pass this in as a third flag argument to implement Sun's - * MS_ASYNC. - */ - syncio = TRUE; - /* - * XXX bummer, gotta flush all cached pages to ensure consistency with - * the file system cache. Otherwise, we could pass this in to - * implement Sun's MS_INVALIDATE. - */ - invalidate = TRUE; + /* * Clean the pages and interpret the return value. */ - rv = vm_map_clean(map, addr, addr + size, syncio, invalidate); + rv = vm_map_clean(map, addr, addr + size, (flags & MS_ASYNC) != 0, + (flags & MS_INVALIDATE) != 0); + switch (rv) { case KERN_SUCCESS: break; @@ -375,6 +371,7 @@ msync(p, uap, retval) default: return (EINVAL); } + return (0); } |