Discussion:
[1003.1(2013)/Issue7+TC1 0000850]: Standardize MAP_ANON
Austin Group Bug Tracker
2014-06-24 22:11:27 UTC
Permalink
The following issue has been SUBMITTED.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-24 22:11 UTC
======================================================================
Summary: Standardize MAP_ANON
Description:
It seems that all modern UNIX-like systems provide an mmap() flag to allow
allocating anonymous memory directly without needing a file descriptor.
Here are my notes from looking through various online manual pages (e.g.,
Solaris, Linux, *BSD, AIX, HPUX, UnixWare):

1. Most systems call it MAP_ANON, but HPUX, AIX, and UnixWare call it
MAP_ANONYMOUS. Some systems provide both; e.g., FreeBSD.

2. Mac OS X allows Mach VM flags to be passed via the "fd" parameter,
but recognizes "-1" as "no flags". Other OSes reject MAP_ANON(YMOUS)?
with fd != -1. Common practice seems to be EINVAL, but at least AIX
specifies EBADF instead.

3. FreeBSD requires offset==0 when using MAP_ANON; Linux and Mac OS X
explicitly document that it's ignored, and other OSes don't seem to
care.


First attempt at desired action below. I made a best effort at formatting
it as I've seen done in previous bug reports. Two notes:

1. Defining a new "anonymous memory object" type seemed the easiest way
to tackle the idea, but the definition is kind of weak. Maybe there's a
better way to define it.

2. There are a *lot* of places in mmap() that mention "fildes", and it
would be tedious to add "Unless MAP_ANON is specified" to all of them, so I
tried to word MAP_ANON to make it clear that fildes shouldn't matter. Not
sure if that's appropriate.
Desired Action:
In XBD 3 Definitions, add (and renumber subsequent entries as
appropriate):

3.XXX Anonymous Memory Object

An object that represents memory not associated with any other
memory objects.

In XBD 3 Definitions under 3.220 Memory Object, between "A file" and "A
shared memory object", add:

* An anonymous memory object (see <a>Anonymous Memory Object</a>).

In <sys/mman.h> under the "symbolic constants for use as flag options"
section, add:

MAP_ANON
Map anonymous memory.

In mmap() under "The mmap() function shall be supported for the following
memory objects", add:

* Anonymous memory objects.

In mmap()'s table about MAP_* symbolic constants, add a row:

MAP_ANON | Map anonymous memory.

In mmap() at an appropriate place (e.g., after the paragraph beginning with
"If MAP_FIXED is specified and <i>addr</i> is non-zero"?), add a
paragraph:

If MAP_ANON is specified, <i>fildes</i> is -1, and <i>off</i> is 0,
then <i>mmap</i>() shall ignore <i>fildes</i> and instead establish a
mapping to a new anonymous memory object of size <i>length</i>. The effect
of specifying MAP_ANON with other values of <i>fildes</i> or <i>off</i> is
unspecified.

In msync() change:

[SHM|TYM]The effect of <i>msync</i>() on a shared memory object or a
typed memory object is unspecified.[/]

to:

The effect of <i>msync</i>() on an anonymous memory object, [SHM]shared
memory object[/], or [TYM]typed memory object[/] is unspecified.
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
======================================================================
Austin Group Bug Tracker
2014-06-24 23:21:43 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-24 23:21 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002274) mdempsky (reporter) - 2014-06-24 23:21
http://austingroupbugs.net/view.php?id=850#c2274
----------------------------------------------------------------------
Two more thoughts:

1. Does a lifetime for anonymous memory objects need to be defined?
E.g., "Anonymous memory objects are destroyed once they're no longer mapped
into any process's address space." in the definition?

2. I suppose it should actually specify "new zero-filled anonymous memory
object of size <i>length</i>" to clarify the initial memory contents.

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
======================================================================
Casper.Dik-QHcLZuEGTsvQT0dZR+
2014-06-25 07:44:26 UTC
Permalink
Post by Austin Group Bug Tracker
1. Most systems call it MAP_ANON, but HPUX, AIX, and UnixWare call it
MAP_ANONYMOUS. Some systems provide both; e.g., FreeBSD.
Solaris also provides both (both were added in Solaris 8)

It requires passing an fd of -1 and returns EBADF if -1 is not
passed and MAP_ANON is passed as a flag.

Casper
Matthew Dempsky
2014-06-25 07:52:32 UTC
Permalink
Post by Casper.Dik-QHcLZuEGTsvQT0dZR+
Solaris also provides both (both were added in Solaris 8)
Ah, good to know. (MAP_ANONYMOUS isn't mentioned in
http://docs.oracle.com/cd/E23824_01/html/821-1463/mmap-2.html.)
Post by Casper.Dik-QHcLZuEGTsvQT0dZR+
It requires passing an fd of -1 and returns EBADF if -1 is not
passed and MAP_ANON is passed as a flag.
For what it's worth, the above linked Solaris manual page specifies
EINVAL instead of EBADF.
Casper.Dik-QHcLZuEGTsvQT0dZR+
2014-06-25 07:59:31 UTC
Permalink
Post by Matthew Dempsky
Post by Casper.Dik-QHcLZuEGTsvQT0dZR+
Solaris also provides both (both were added in Solaris 8)
Ah, good to know. (MAP_ANONYMOUS isn't mentioned in
http://docs.oracle.com/cd/E23824_01/html/821-1463/mmap-2.html.)
Post by Casper.Dik-QHcLZuEGTsvQT0dZR+
It requires passing an fd of -1 and returns EBADF if -1 is not
passed and MAP_ANON is passed as a flag.
For what it's worth, the above linked Solaris manual page specifies
EINVAL instead of EBADF.
It returns EINVAL when the file descriptor is valid and it returns EBADF
if it is not.

I didn't properly follow all the code paths so I stand corrected; it may
return either EINVAL (valid file descriptor) or EBADF (bad file descriptor
not equal to -1)

Casper
Austin Group Bug Tracker
2014-06-26 16:40:28 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://www.austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-26 16:40 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002281) rhansen (reporter) - 2014-06-26 16:40
http://www.austingroupbugs.net/view.php?id=850#c2281
----------------------------------------------------------------------
On page 37 after line 1195 (XBD 3.15 definition of Angle Brackets), add a
new section (and renumber subsequent entries as appropriate):

<blockquote>3.16 Anonymous Memory Object<blockquote>An object that
represents memory not associated with any other memory
objects.</blockquote></blockquote>

On page 68 after line 1972 (XBD 3.22 definition of Memory Object), add:

<blockquote><ul><li>An anonymous memory object (see Section 3.16 on page
37).</li></ul></blockquote>

On page 372 after line 12515 (XBD <sys/mman.h> description), add:

<blockquote>MAP_ANONYMOUS<blockquote>Map anonymous
memory.</blockquote></blockquote>

On page 1322 after line 43724 (XSH mmap() description), add:

<blockquote><ul><li>Anonymous memory objects.</li></ul></blockquote>

On page 1322 line 43730 (XSH mmap() description) change:

<blockquote>The <i>mmap</i>() function shall establish a mapping between
the address space of the process at an address <i>pa</i> for <i>len</i>
bytes to the memory object represented by the file descriptor <i>fildes</i>
at offset <i>off</i> for <i>len</i> bytes.</blockquote>

to:

<blockquote>The <i>mmap</i>() function shall establish a mapping between
the address space of the process at an address <i>pa</i> for <i>len</i>
bytes to the memory object represented by the file descriptor <i>fildes</i>
at offset <i>off</i> for <i>len</i> bytes, or to an anonymous memory object
of <i>len</i> bytes.</blockquote>

On page 1323 after line 43773 (XSH mmap() description, table about MAP_*
symbolic constants), add a row:

<blockquote>MAP_ANONYMOUS | Map anonymous memory.</blockquote>

On page 1324 after line 43823 (XSH mmap() description), add a new
paragraph:

<blockquote>If MAP_ANONYMOUS is specified, <i>fildes</i> is -1, and
<i>off</i> is 0, then <i>mmap</i>() shall ignore <i>fildes</i> and instead
establish a mapping to a new anonymous memory object of size <i>len</i>.
The effect of specifying MAP_ANONYMOUS with other values of <i>fildes</i>
or <i>off</i> is unspecified. Anonymous memory objects shall be
initialized to all bits zero.</blockquote>

On page 1328 after line 43989 (XSH mmap() rationale), add a new paragraph:

<blockquote>Many existing implementations support MAP_ANON as a synonym for
MAP_ANONYMOUS. MAP_ANONYMOUS was chosen for standardization because that
spelling is supported in more existing implementations.</blockquote>

On page 1365 lines 45154-45155 (XSH msync() description) change:

<blockquote>[SHM|TYM]The effect of <i>msync</i>() on a shared memory object
or a typed memory object is unspecified.[/]</blockquote>

to:

<blockquote>The effect of <i>msync</i>() on an anonymous memory object,
[SHM]shared memory object[/], or [TYM]typed memory object[/] is
unspecified.</blockquote>

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
======================================================================
Austin Group Bug Tracker
2014-06-26 16:50:38 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://www.austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-26 16:50 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002282) rhansen (reporter) - 2014-06-26 16:50
http://www.austingroupbugs.net/view.php?id=850#c2282
----------------------------------------------------------------------
This bug was discussed during today's teleconference but we ran out of
time. We will continue the discussion at the next teleconference (two
weeks from today). To encourage review and feedback, the current draft is
in http://www.austingroupbugs.net/view.php?id=850#c2281. That bugnote might be
edited in the future.

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
======================================================================
Austin Group Bug Tracker
2014-06-26 16:51:19 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-26 16:51 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002283) geoffclare (manager) - 2014-06-26 16:51
http://austingroupbugs.net/view.php?id=850#c2283
----------------------------------------------------------------------
The mmap() ERRORS section is going to need some work, notably for EACCES,
EBADF, and ENODEV.

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
======================================================================
Austin Group Bug Tracker
2014-06-26 17:49:08 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-26 17:49 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002284) mdempsky (reporter) - 2014-06-26 17:49
http://austingroupbugs.net/view.php?id=850#c2284
----------------------------------------------------------------------
Just curious, can you share the rationale from the conference call on why
MAP_ANONYMOUS was chosen instead of MAP_ANON? I suppose because
MAP_ANONYMOUS is more common among UNIX 03 certified systems?

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
======================================================================
Austin Group Bug Tracker
2014-06-26 18:09:08 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-26 18:09 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002285) mdempsky (reporter) - 2014-06-26 18:09
http://austingroupbugs.net/view.php?id=850#c2285
----------------------------------------------------------------------
Oops, nevermind, reading the proposed wording I see that rationale was
given.

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
======================================================================
Austin Group Bug Tracker
2014-06-28 08:08:49 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-28 08:08 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002292) geoffclare (manager) - 2014-06-28 08:08
http://austingroupbugs.net/view.php?id=850#c2292
----------------------------------------------------------------------
Some info regarding the two names...

On searchcode.com MAP_ANON gets 3289 hits and MAP_ANONYMOUS gets 2206.
Since
MAP_ANON matches both names this implies that MAP_ANON by itself only has
1083.

Interestingly, the first hit for MAP_ANONYMOUS is this code snippet from
the python source:

/* Prefer MAP_ANONYMOUS since MAP_ANON is deprecated according to man page.
*/
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
#endif

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
2014-06-28 08:08 geoffclare Note Added: 0002292
======================================================================
Austin Group Bug Tracker
2014-06-30 19:02:02 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-30 19:02 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002295) mdempsky (reporter) - 2014-06-30 19:02
http://austingroupbugs.net/view.php?id=850#c2295
----------------------------------------------------------------------
For what it's worth, there's a widespread mmap-anon.m4 autoconf macro
package from the Free Software Foundation that makes this claim at the
top:

# Detect how mmap can be used to create anonymous (not file-backed) memory
# mappings.
# - 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, only MAP_ANON exists.
# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must
be
# used.

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
2014-06-28 08:08 geoffclare Note Added: 0002292
2014-06-30 19:02 mdempsky Note Added: 0002295
======================================================================
Austin Group Bug Tracker
2014-06-30 19:38:38 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-06-30 19:38 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002296) rhansen (reporter) - 2014-06-30 19:38
http://austingroupbugs.net/view.php?id=850#c2296
----------------------------------------------------------------------
According to [1], FreeBSD now supports MAP_ANONYMOUS as a synonym for
MAP_ANON. The NetBSD, OpenBSD, and Mac OS X man pages do not mention
MAP_ANONYMOUS.

[1] http://www.freebsd.org/cgi/man.cgi?query=mmap&sektion=2

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
2014-06-28 08:08 geoffclare Note Added: 0002292
2014-06-30 19:02 mdempsky Note Added: 0002295
2014-06-30 19:38 rhansen Note Added: 0002296
======================================================================
Austin Group Bug Tracker
2014-07-01 03:16:41 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-07-01 03:16 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002298) rhansen (reporter) - 2014-07-01 03:16
http://austingroupbugs.net/view.php?id=850#c2298
----------------------------------------------------------------------
NetBSD just committed a change adding MAP_ANONYMOUS as a synonym for
MAP_ANON.

http://mail-index.netbsd.org/source-changes/2014/06/30/msg055938.html

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
2014-06-28 08:08 geoffclare Note Added: 0002292
2014-06-30 19:02 mdempsky Note Added: 0002295
2014-06-30 19:38 rhansen Note Added: 0002296
2014-07-01 03:16 rhansen Note Added: 0002298
======================================================================
Austin Group Bug Tracker
2014-07-01 22:18:59 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-07-01 22:18 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002299) mdempsky (reporter) - 2014-07-01 22:18
http://austingroupbugs.net/view.php?id=850#c2299
----------------------------------------------------------------------
OpenBSD would still prefer to see MAP_ANON standardized, as that's the more
historic name and (slightly) more widely available, even if Linux's man
pages chose to document it as "deprecated". (MAP_ANON was added to BSD's
<sys/mman.h> header by Kirk McKusick on December 5, 1990; MAP_ANONYMOUS was
added to Linux's <linux/mman.h> header by Linus on Jan 18, 1994.) But as
long as the semantics remain compatible, I don't object to MAP_ANONYMOUS.

Also, I've submitted an Apple Bug Report (17525652) to alert Apple's
engineering team about this proposal. Hopefully they'll chime in directly,
but if not I'll proxy anything I hear back from them.

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
2014-06-28 08:08 geoffclare Note Added: 0002292
2014-06-30 19:02 mdempsky Note Added: 0002295
2014-06-30 19:38 rhansen Note Added: 0002296
2014-07-01 03:16 rhansen Note Added: 0002298
2014-07-01 22:18 mdempsky Note Added: 0002299
======================================================================
Austin Group Bug Tracker
2014-07-01 23:37:53 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=850
======================================================================
Reported By: mdempsky
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 850
Category: System Interfaces
Type: Enhancement Request
Severity: Editorial
Priority: normal
Status: New
Name: Matthew Dempsky
Organization: OpenBSD
User Reference:
Section: mmap
Page Number:
Line Number:
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-24 22:11 UTC
Last Modified: 2014-07-01 23:37 UTC
======================================================================
Summary: Standardize MAP_ANON
======================================================================

----------------------------------------------------------------------
(0002300) mdempsky (reporter) - 2014-07-01 23:37
http://austingroupbugs.net/view.php?id=850#c2300
----------------------------------------------------------------------
One more data point: the third edition of "Advanced Programming in the UNIX
environment" (published 2013) still recommends using MAP_ANON:
http://books.google.com/books?id=_kpsAQAAQBAJ&lpg=PA578&pg=PA578

According to http://apuebook.com/about3e.html (since the Preface section is
missing from the Google Books preview): "The four platforms used to test
the examples in the book include FreeBSD 8.0, Linux 3.2.0, Mac OS X 10.6.8
and Solaris 10."

Issue History
Date Modified Username Field Change
======================================================================
2014-06-24 22:11 mdempsky New Issue
2014-06-24 22:11 mdempsky Name => Matthew Dempsky
2014-06-24 22:11 mdempsky Organization => OpenBSD
2014-06-24 22:11 mdempsky Section => mmap
2014-06-24 23:10 eadler Issue Monitored: eadler
2014-06-24 23:21 mdempsky Note Added: 0002274
2014-06-26 16:40 rhansen Note Added: 0002281
2014-06-26 16:50 rhansen Note Added: 0002282
2014-06-26 16:51 geoffclare Note Added: 0002283
2014-06-26 17:49 mdempsky Note Added: 0002284
2014-06-26 18:09 mdempsky Note Added: 0002285
2014-06-28 08:08 geoffclare Note Added: 0002292
2014-06-30 19:02 mdempsky Note Added: 0002295
2014-06-30 19:38 rhansen Note Added: 0002296
2014-07-01 03:16 rhansen Note Added: 0002298
2014-07-01 22:18 mdempsky Note Added: 0002299
2014-07-01 23:37 mdempsky Note Added: 0002300
======================================================================
Bruce Korb
2014-07-02 16:21:52 UTC
Permalink
Post by Austin Group Bug Tracker
----------------------------------------------------------------------
One more data point: the third edition of "Advanced Programming in the UNIX
environment" (published 2013) still recommends using MAP_ANON: [...]
It has become really clear: toss a coin for the preferred name and
strongly recommend the other be an alias. IOW, sensible implementations
ought to support both names. Nobody wants compilation failures because
some source some where happened to choose the "wrong" name.
Rich Felker
2014-07-02 18:21:33 UTC
Permalink
Post by Bruce Korb
Post by Austin Group Bug Tracker
----------------------------------------------------------------------
One more data point: the third edition of "Advanced Programming in the UNIX
environment" (published 2013) still recommends using MAP_ANON: [...]
It has become really clear: toss a coin for the preferred name and
strongly recommend the other be an alias. IOW, sensible implementations
ought to support both names. Nobody wants compilation failures because
some source some where happened to choose the "wrong" name.
I agree 100%. Which name is "official" and which is the alias does not
matter, but both should be adopted by the standard, so that portable
applications do not have to choose between using the one that's
standardized and the one that's supported on the historical
implementations they care about.

Rich
Joerg Schilling
2014-07-03 09:05:21 UTC
Permalink
Post by Rich Felker
Post by Bruce Korb
Post by Austin Group Bug Tracker
----------------------------------------------------------------------
One more data point: the third edition of "Advanced Programming in the UNIX
environment" (published 2013) still recommends using MAP_ANON: [...]
It has become really clear: toss a coin for the preferred name and
strongly recommend the other be an alias. IOW, sensible implementations
ought to support both names. Nobody wants compilation failures because
some source some where happened to choose the "wrong" name.
I agree 100%. Which name is "official" and which is the alias does not
matter, but both should be adopted by the standard, so that portable
applications do not have to choose between using the one that's
standardized and the one that's supported on the historical
implementations they care about.
Should we add this to the rationale section?

Jörg
--
EMail:joerg-3Qm2Liu6aU2sY6utFDHCwYAplN+***@public.gmane.org (home) Jörg Schilling D-13353 Berlin
js-CFLBMwTPW48UNGrzBIF7/***@public.gmane.org (uni)
joerg.schilling-8LS2qeF34IpklNlQbfROjRvVK+***@public.gmane.org (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/
Geoff Clare
2014-07-03 09:35:52 UTC
Permalink
Post by Joerg Schilling
Post by Rich Felker
Post by Bruce Korb
It has become really clear: toss a coin for the preferred name and
strongly recommend the other be an alias. IOW, sensible implementations
ought to support both names. Nobody wants compilation failures because
some source some where happened to choose the "wrong" name.
I agree 100%. Which name is "official" and which is the alias does not
matter, but both should be adopted by the standard, so that portable
applications do not have to choose between using the one that's
standardized and the one that's supported on the historical
implementations they care about.
Should we add this to the rationale section?
Here's one way we could handle it...

Where we add MAP_ANONYMOUS to <sys/mman.h> also add:

MAP_ANON Synonym for MAP_ANONYMOUS

and in FUTURE DIRECTIONS for <sys/mman.h> change "None" to:

The MAP_ANON synonym for MAP_ANONYMOUS is included initially to
simplify porting historical applications to implementations of
this standard; it may be removed in a future version.

This would encourage application writers to use MAP_ANONYMOUS
while allowing a lengthy grace period in which both will work.
(The earliest version in which MAP_ANON would be removed is SUSv7,
as it would first be marked OB in SUSv6.)
--
Geoff Clare <g.clare-7882/***@public.gmane.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
Richard Hansen
2014-07-03 21:41:01 UTC
Permalink
Post by Geoff Clare
Here's one way we could handle it...
MAP_ANON Synonym for MAP_ANONYMOUS
also add it to the table on page 1323
Post by Geoff Clare
The MAP_ANON synonym for MAP_ANONYMOUS is included initially to
simplify porting historical applications to implementations of
this standard; it may be removed in a future version.
This would encourage application writers to use MAP_ANONYMOUS
while allowing a lengthy grace period in which both will work.
(The earliest version in which MAP_ANON would be removed is SUSv7,
as it would first be marked OB in SUSv6.)
I like this.

I'd also like to change the proposed rationale; the second sentence is
looking more and more questionable given recent posts about
implementation support for MAP_ANON vs. MAP_ANONYMOUS. Perhaps
something like this:

Some historical implementations only supported MAP_ANON, some only
supported MAP_ANONYMOUS, and some supported both spellings. This
standard includes both spellings partly for application compatibility
and partly because neither spelling was clearly more popular than the
other at the time this feature was considered for standardization.
Although both are required, the chosen wording implies that
MAP_ANONYMOUS is favored over MAP_ANON. This is deliberate, and was
done for a few reasons:

* Favoring one spelling over the other encourages applications to
migrate to a single spelling, which facilitates deprecation and
removal of the other spelling.

* A quick survey of applications suggested that more applications
chose MAP_ANONYMOUS when both were available.

* Of the implementations that supported both spellings, some
documented a clear preference for MAP_ANONYMOUS over MAP_ANON.

* MAP_ANONYMOUS is a closer stylistic match to the other MAP_*
flags (none of the other flag names are abbreviations).

Thoughts?

-Richard
Matthew Dempsky
2014-07-03 22:51:54 UTC
Permalink
Post by Richard Hansen
Post by Geoff Clare
The MAP_ANON synonym for MAP_ANONYMOUS is included initially to
simplify porting historical applications to implementations of
this standard; it may be removed in a future version.
This would encourage application writers to use MAP_ANONYMOUS
while allowing a lengthy grace period in which both will work.
(The earliest version in which MAP_ANON would be removed is SUSv7,
as it would first be marked OB in SUSv6.)
I like this.
Seems agreeable to me too.
Post by Richard Hansen
* Of the implementations that supported both spellings, some
documented a clear preference for MAP_ANONYMOUS over MAP_ANON.
FWIW, I believe only Linux describes MAP_ANON as "deprecated", whereas
both Solaris and FreeBSD describe MAP_ANONYMOUS as only for
"compatibility". So I don't think that makes for a compelling
argument.
Rich Felker
2014-07-04 05:17:25 UTC
Permalink
Post by Matthew Dempsky
Post by Richard Hansen
Post by Geoff Clare
The MAP_ANON synonym for MAP_ANONYMOUS is included initially to
simplify porting historical applications to implementations of
this standard; it may be removed in a future version.
This would encourage application writers to use MAP_ANONYMOUS
while allowing a lengthy grace period in which both will work.
(The earliest version in which MAP_ANON would be removed is SUSv7,
as it would first be marked OB in SUSv6.)
I like this.
Seems agreeable to me too.
Post by Richard Hansen
* Of the implementations that supported both spellings, some
documented a clear preference for MAP_ANONYMOUS over MAP_ANON.
FWIW, I believe only Linux describes MAP_ANON as "deprecated", whereas
both Solaris and FreeBSD describe MAP_ANONYMOUS as only for
"compatibility". So I don't think that makes for a compelling
argument.
I don't see any value in deprecating one or the other; it just
politicizes the issue and builds resentment for the standards process
with the side whose choice is slated for deprecation. Note that we
have both PAGE_SIZE and PAGESIZE (and likewise, _SC_PAGE_SIZE and
_SC_PAGESIZE) with no looming threat that one will be removed, so I
think there's good precedent for, when there are two historical
spellings, supporting both.

Of course I mainly just want this feature standardized, and don't
really care which name it gets, so if others are adamant about
deprecating one or the other I don't see it as an issue worth blocking
progress over.

Rich
Geoff Clare
2014-07-04 08:59:07 UTC
Permalink
Post by Rich Felker
I don't see any value in deprecating one or the other; it just
politicizes the issue and builds resentment for the standards process
with the side whose choice is slated for deprecation. Note that we
have both PAGE_SIZE and PAGESIZE (and likewise, _SC_PAGE_SIZE and
_SC_PAGESIZE) with no looming threat that one will be removed, so I
think there's good precedent for, when there are two historical
spellings, supporting both.
That's a good point about PAGE[_]SIZE. It certainly provides a
precedent for just including both names with equal status.
--
Geoff Clare <g.clare-7882/***@public.gmane.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
Loading...