msync(2) must return ENOMEM and not EINVAL when the address is outside the

allowed range or when one or more pages are not mapped. This according to
The Open Group Base Specifications Issue 7.

Discussed with:	 attilio, Bruce Evans
Reviewed by:	 alc, Garrett Cooper
Reported by:	 ATF
MFC after:	 2 weeks
Sponsored by:	EMC / Isilon storage division
This commit is contained in:
pho 2014-05-07 08:38:02 +00:00
parent 8c9ec09dd9
commit 1108602cbc
2 changed files with 8 additions and 6 deletions

View File

@ -87,11 +87,13 @@ The
.Fa addr .Fa addr
argument argument
is not a multiple of the hardware page size. is not a multiple of the hardware page size.
.It Bq Er EINVAL .It Bq Er ENOMEM
The The addresses in the range starting at
.Fa addr
and continuing for
.Fa len .Fa len
argument bytes are outside the range allowed for the address space of a
is too large or negative. process or specify one or more pages that are not mapped.
.It Bq Er EINVAL .It Bq Er EINVAL
The The
.Fa flags .Fa flags
@ -99,7 +101,7 @@ argument
was both MS_ASYNC and MS_INVALIDATE. was both MS_ASYNC and MS_INVALIDATE.
Only one of these flags is allowed. Only one of these flags is allowed.
.It Bq Er EIO .It Bq Er EIO
An error occurred while writing at least one of the pages in An error occurred while writing at least one of the pages in
the specified region. the specified region.
.El .El
.Sh SEE ALSO .Sh SEE ALSO

View File

@ -556,7 +556,7 @@ sys_msync(td, uap)
case KERN_SUCCESS: case KERN_SUCCESS:
return (0); return (0);
case KERN_INVALID_ADDRESS: case KERN_INVALID_ADDRESS:
return (EINVAL); /* Sun returns ENOMEM? */ return (ENOMEM);
case KERN_INVALID_ARGUMENT: case KERN_INVALID_ARGUMENT:
return (EBUSY); return (EBUSY);
case KERN_FAILURE: case KERN_FAILURE: