From 2434c3c3f28c6f93d353bcb1417d3b71a80a68cb Mon Sep 17 00:00:00 2001 From: pho Date: Wed, 21 May 2014 09:19:05 +0000 Subject: [PATCH] MFC r265534: 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. Sponsored by: EMC / Isilon storage division git-svn-id: svn://svn.freebsd.org/base/stable/10@266492 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libc/sys/msync.2 | 12 +++++++----- sys/vm/vm_mmap.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libc/sys/msync.2 b/lib/libc/sys/msync.2 index 42d800541..a91faf2a6 100644 --- a/lib/libc/sys/msync.2 +++ b/lib/libc/sys/msync.2 @@ -87,11 +87,13 @@ The .Fa addr argument is not a multiple of the hardware page size. -.It Bq Er EINVAL -The +.It Bq Er ENOMEM +The addresses in the range starting at +.Fa addr +and continuing for .Fa len -argument -is too large or negative. +bytes are outside the range allowed for the address space of a +process or specify one or more pages that are not mapped. .It Bq Er EINVAL The .Fa flags @@ -99,7 +101,7 @@ argument was both MS_ASYNC and MS_INVALIDATE. Only one of these flags is allowed. .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. .El .Sh SEE ALSO diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 17f8cad63..76479d915 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -556,7 +556,7 @@ sys_msync(td, uap) case KERN_SUCCESS: return (0); case KERN_INVALID_ADDRESS: - return (EINVAL); /* Sun returns ENOMEM? */ + return (ENOMEM); case KERN_INVALID_ARGUMENT: return (EBUSY); case KERN_FAILURE: -- 2.45.0