Skip to contentSkip to conversation

mmap(2): MAP_ANON

DISCUSSION Michael Kerrisk (man-pages) 2 participants 3 messages Apr 14, 2020 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 16 lines · Heinrich Schuchardt

Hello Michael,

in the mmap(2) man page MAP_ANON is described as deprecated.

When I look at the NetBSD manpage
http://netbsd.gw.com/cgi-bin/man-cgi?mmap+2+NetBSD-current
I found that MAP_ANONYMOUS is not defined.

https://www.dragonflybsd.org/cgi/web-man?command=mmap&section=2
indicates MAP_ANONYMOUS is an alias for MAP_ANON and is provided for compatibility.

https://man.openbsd.org/mmap.2 also knows MAP_ANONYMOUS as a synonym.

https://www.unix.com/man-page/osx/2/mmap/ does not know MAP_ANONYMOUS.

Quoted 7 lines

So shouldn't the man page indicate that MAP_ANON is to be favored to write portable code? And correspondingly mark MAP_ANONYMOUS as synonym only kept for compatibility.

The Open Group Base Specifications Issue 7, 2018 Edition does not reference either of both. So both values are not POSIX but it is not correct to describe them as Linux only.

The text saying that MAP_ANON is deprecated is ancient (at least 20 years old). I don't know why that text was added.

Things are not simple though: it looks like there's at least one historical implementation (HP-US) that defines MAP_ANONYMOUS but not MAP_ANON.

I've applied the patch below.

Thanks,

Michael

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#2 lore raw
Quoted 25 lines · Michael Kerrisk (man-pages)
Quoted 16 lines · Heinrich Schuchardt

Hello Michael,

in the mmap(2) man page MAP_ANON is described as deprecated.

When I look at the NetBSD manpage
http://netbsd.gw.com/cgi-bin/man-cgi?mmap+2+NetBSD-current
I found that MAP_ANONYMOUS is not defined.

https://www.dragonflybsd.org/cgi/web-man?command=mmap&section=2
indicates MAP_ANONYMOUS is an alias for MAP_ANON and is provided for compatibility.

https://man.openbsd.org/mmap.2 also knows MAP_ANONYMOUS as a synonym.

https://www.unix.com/man-page/osx/2/mmap/ does not know MAP_ANONYMOUS.

Quoted 7 lines

So shouldn't the man page indicate that MAP_ANON is to be favored to write portable code? And correspondingly mark MAP_ANONYMOUS as synonym only kept for compatibility.

The Open Group Base Specifications Issue 7, 2018 Edition does not reference either of both. So both values are not POSIX but it is not correct to describe them as Linux only.

Quoted 8 lines

The text saying that MAP_ANON is deprecated is ancient (at least 20 years old). I don't know why that text was added.

Things are not simple though: it looks like there's at least one historical implementation (HP-US) that defines MAP_ANONYMOUS but not MAP_ANON.

I've applied the patch below.

Somehow the patch got lost in the mail. Couldn't identify it upstream
(https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git) either.

Best regards

Heinrich

Quoted 4 lines

Thanks,

Michael

#3 lore raw
Quoted 4 lines
Quoted 1 line

I've applied the patch below.

Somehow the patch got lost in the mail. Couldn't identify it upstream
(https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git) either.

Ooops. This time...

Cheers,

Michael

man2/mmap.2 +2 -2
index 963776e80..667cf311d 100644
@@ -193,8 +193,8 @@ is set.
 .TP
 .B MAP_ANON
 Synonym for
-.BR MAP_ANONYMOUS .
-Deprecated.
+.BR MAP_ANONYMOUS ;
+provided for compatibility with other implementations.
 .TP
 .B MAP_ANONYMOUS
 The mapping is not backed by any file;
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/