On Thu, Jul 14, 2022 at 4:14 PM Bruno Haible <br...@clisp.org> wrote: > > Hi, > > Eric Gallager wrote: > > Hi, I was just writing because I noticed a few nits with gnulib's > > documentation of mmap here: > > https://www.gnu.org/software/gnulib/manual/html_node/mmap.html > > 1. there's a missing close-parenthesis after "even without MAP_FIXED" > > Thanks; fixed: > https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=5d2d12d7b5aeb023a2e45f5625a07777564caa27 > > > 2. there's no discussion of how sometimes MAP_ANONYMOUS is written as > > just MAP_ANON instead. > > This is an issue with the header file <sys/mman.h>, not with the function > mmap(). Therefore it would have to be documented in > https://www.gnu.org/software/gnulib/manual/html_node/sys_002fmman_002eh.html > > But in fact, POSIX does not require MAP_ANONYMOUS nor MAP_ANON, see > https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/sys_mman.h.html, > and Gnulib does not correct it (one way or the other). > > > This GitHub issue for libressl-portable has a > > (probably outdated) table covering which platforms support which > > spelling: https://github.com/libressl-portable/portable/issues/24 > > Gnulib also has this info, in m4/mmap-anon.m4 (dating from 2009): >
OK, would it be worthwhile to at least add a cross-reference, then? > # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS > # and MAP_ANON exist and have the same value. > # - On HP-UX, only MAP_ANONYMOUS exists. > # - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. > # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be > # used. > > Meanwhile, Mac OS X and the BSDs also support both spellings: > # - On Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, AIX, OSF/1, Solaris, Cygwin, > # Interix, Haiku, both MAP_ANONYMOUS and MAP_ANON exist and have the same > value. > # - On HP-UX, only MAP_ANONYMOUS exists. > # - On Minix, only MAP_ANON exists. > # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be > # used. > > HP-UX, Minix, IRIX are no longer relevant for most programs. Therefore it's > nowadays OK to use either MAP_ANONYMOUS or MAP_ANON, and both will work. > > Bruno > > >