So, the msync implementation in uvm says this:
/*
* XXXCDC: do we really need this semantic?
*
* XXX Gak! If size is zero we are supposed to sync "all
modified
* pages with the region containing addr". Unfortunately, we
* don't really keep track of individual mmaps so we approximate
* by flushing the range of the map entry containing addr.
* This can be incorrect if the region splits or is coalesced
* with a neighbor.
*/
I checked in posix and can find no reference to this at all. So I would
like to suggest this diff. This of course needs quite a bit of testing
(a ports bulk build would be nice), but removing unnecessary crap makes
people happy. Otoh, if something actually depends on this then it may
need to stay.
Cheers,
-0-
diff --git uvm/uvm_mmap.c uvm/uvm_mmap.c
index 168ac46..f0615c7 100644
--- uvm/uvm_mmap.c
+++ uvm/uvm_mmap.c
@@ -637,7 +637,7 @@ sys_msync(struct proc *p, void *v, register_t *retval)
vaddr_t addr;
vsize_t size, pageoff;
vm_map_t map;
- int rv, flags, uvmflags;
+ int flags, uvmflags;
/*
* extract syscall args from the uap
@@ -669,30 +669,6 @@ sys_msync(struct proc *p, void *v, register_t *retval)
map = &p->p_vmspace->vm_map;
/*
- * XXXCDC: do we really need this semantic?
- *
- * XXX Gak! If size is zero we are supposed to sync "all modified
- * pages with the region containing addr". Unfortunately, we
- * don't really keep track of individual mmaps so we approximate
- * by flushing the range of the map entry containing addr.
- * This can be incorrect if the region splits or is coalesced
- * with a neighbor.
- */
- if (size == 0) {
- vm_map_entry_t entry;
-
- vm_map_lock_read(map);
- rv = uvm_map_lookup_entry(map, addr, &entry);
- if (rv == TRUE) {
- addr = entry->start;
- size = entry->end - entry->start;
- }
- vm_map_unlock_read(map);
- if (rv == FALSE)
- return (EINVAL);
- }
-
- /*
* translate MS_ flags into PGO_ flags
*/
uvmflags = PGO_CLEANIT;
--
The rain it raineth on the just
And also on the unjust fella,
But chiefly on the just, because
The unjust steals the just's umbrella.
--Lord Bowen