From d3d881232bdfd9bcd2b65c27fa94c1cb7c2dd0d0 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 14 Nov 2019 12:52:40 +0100 Subject: [PATCH] mmap.2: Note that MAP_STACK exists on some other systems As noted in man-pages commit 99c3a000279919cc4875c9dfa9c, MAP_STACK exists on at least OpenBSD and FreeBSD. Signed-off-by: Michael Kerrisk --- man2/mmap.2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man2/mmap.2 b/man2/mmap.2 index 4637b9845..f7e6f4fdf 100644 --- a/man2/mmap.2 +++ b/man2/mmap.2 @@ -403,6 +403,7 @@ is supported for private mappings only since Linux 2.6.23. .BR MAP_STACK " (since Linux 2.6.27)" Allocate the mapping at an address suitable for a process or thread stack. +.IP This flag is currently a no-op, but is used in the glibc threading implementation so that if some architectures require special treatment for stack allocations, @@ -412,6 +413,9 @@ support can later be transparently implemented for glibc. .\" http://thread.gmane.org/gmane.linux.kernel/720412 .\" "pthread_create() slow for many threads; also time to revisit 64b .\" context switch optimization?" +A further reason to employ this flag is portability: +.BR MAP_SHARED +exists (and has an effect) on some other systems (e.g., some of the BSDs). .TP .BR MAP_SYNC " (since Linux 4.15)" This flag is available only with the