NOTES: Added details on mapping address that is selected by

kernel when MAP_FIXED is / isn't specified.
This commit is contained in:
Michael Kerrisk 2008-05-21 12:33:21 +00:00
parent a1376a2233
commit 80d17cfa1a
1 changed files with 16 additions and 1 deletions

View File

@ -36,7 +36,7 @@
.\" Modified 2006-12-04, mtk, various parts rewritten
.\" 2007-07-10, mtk, Added an example program.
.\"
.TH MMAP 2 2008-05-05 "Linux" "Linux Programmer's Manual"
.TH MMAP 2 2008-06-05 "Linux" "Linux Programmer's Manual"
.SH NAME
mmap, munmap \- map or unmap files or devices into memory
.SH SYNOPSIS
@ -481,6 +481,21 @@ or not.
Portable programs should always set
.B PROT_EXEC
if they intend to execute code in the new mapping.
The portable way to create a mapping is to specify
.I addr
as 0 (NULL), and omit
.B MAP_FIXED
from
.IR flags .
In this case, the system chooses the address for the mapping;
the address is chosen so as not to conflict with any extant mapping,
and will not be 0.
If the
.B MAP_FIXED
flag is specified, and
.I addr
is 0 (NULL), then the mapped adddress will be 0 (NULL).
.SH BUGS
On Linux there are no guarantees like those suggested above under
.BR MAP_NORESERVE .