diff --git a/man2/mmap.2 b/man2/mmap.2 index 1b70a57c5..ff657c5c1 100644 --- a/man2/mmap.2 +++ b/man2/mmap.2 @@ -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 .