Changes to msync(2)

- Return EBUSY if the region was wired by mlock(2) and MS_INVALIDATE
   is specified to msync(2).  This is required by the Open Group Base
   Specifications Issue 6.
 - vm_map_sync() doesn't return KERN_FAILURE.  Thus, msync(2) can't
   possibly return EIO.
 - The second major loop in vm_map_sync() handles sub maps.  Thus,
   failing on sub maps in the first major loop isn't necessary.
This commit is contained in:
Alan Cox 2003-11-14 06:55:11 +00:00
parent 614e1f02e8
commit b7b7cd4421
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122646
2 changed files with 4 additions and 4 deletions

View File

@ -1985,10 +1985,10 @@ vm_map_sync(
end = entry->end;
}
/*
* Make a first pass to check for holes.
* Make a first pass to check for user-wired memory and holes.
*/
for (current = entry; current->start < end; current = current->next) {
if (current->eflags & MAP_ENTRY_IS_SUB_MAP) {
if (invalidate && (current->eflags & MAP_ENTRY_USER_WIRED)) {
vm_map_unlock_read(map);
return (KERN_INVALID_ARGUMENT);
}

View File

@ -558,8 +558,8 @@ msync(td, uap)
return (0);
case KERN_INVALID_ADDRESS:
return (EINVAL); /* Sun returns ENOMEM? */
case KERN_FAILURE:
return (EIO);
case KERN_INVALID_ARGUMENT:
return (EBUSY);
default:
return (EINVAL);
}