bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 minor nits with mmap documentation page


From: Bruno Haible
Subject: Re: 2 minor nits with mmap documentation page
Date: Thu, 14 Jul 2022 22:13:38 +0200

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):

# - 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]