diff options
author | kib <kib@FreeBSD.org> | 2014-06-19 05:00:39 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-06-19 05:00:39 +0000 |
commit | 893100aa1069cfe6adb4d0da5ef456c6932183e9 (patch) | |
tree | b847ae6506c709809c1cbb861579f0167b5fcee8 /lib/libc/sys | |
parent | 338a93135ac64d3c6d03bb50017860f1570d345e (diff) | |
download | FreeBSD-src-893100aa1069cfe6adb4d0da5ef456c6932183e9.zip FreeBSD-src-893100aa1069cfe6adb4d0da5ef456c6932183e9.tar.gz |
Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED,
and prevents the request from deleting existing mappings in the
region, failing instead.
Reviewed by: alc
Discussed with: jhb
Tested by: markj, pho (previous version, as part of the bigger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/mmap.2 | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2 index 01cde0e..3dd8303 100644 --- a/lib/libc/sys/mmap.2 +++ b/lib/libc/sys/mmap.2 @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd September 9, 2013 +.Dd June 19, 2014 .Dt MMAP 2 .Os .Sh NAME @@ -141,6 +141,12 @@ argument must be 0. This flag is identical to .Dv MAP_ANON and is provided for compatibility. +.It Dv MAP_EXCL +This flag can only be used in combination with +.Dv MAP_FIXED . +Please see the definition of +.Dv MAP_FIXED +for the description of its effect. .It Dv MAP_FIXED Do not permit the system to select a different address than the one specified. @@ -152,17 +158,21 @@ If is specified, .Fa addr must be a multiple of the pagesize. -If a +If +.Dv MAP_EXCL +is not specified, a successfull .Dv MAP_FIXED -request is successful, the mapping established by -.Fn mmap -replaces any previous mappings for the process' pages in the range from +request replaces any previous mappings for the process' +pages in the range from .Fa addr to .Fa addr + .Fa len . -Use of this option is discouraged. +In contrast, if +.Dv MAP_EXCL +is specified, the request will fail if a mapping +already exists within the range. .It Dv MAP_HASSEMAPHORE Notify the kernel that the region may contain semaphores and that special handling may be necessary. @@ -393,6 +403,17 @@ argument was not -1. was specified and the .Fa offset argument was not 0. +.It Bq Er EINVAL +Both +.Dv MAP_FIXED +and +.Dv MAP_EXCL +were specified, but the requested region is already used by a mapping. +.It Bq Er EINVAL +.Dv MAP_EXCL +was specified, but +.Dv MAP_FIXED +was not. .It Bq Er ENODEV .Dv MAP_ANON has not been specified and |