I filed an enhancement request with the Austin Group to standardize an
mmap() flag for mapping anonymous memory.  I proposed standardizing
MAP_ANON, but the current proposal is to standardize MAP_ANONYMOUS
instead, as that seems to be the more common definition and usage:

    http://austingroupbugs.net/view.php?id=850

All else equal, I prefer MAP_ANON as it's shorter and it's also the
original BSD name; but I prefer having a standardized name even more.
If anyone objects and has convincing arguments for why POSIX should
standardize MAP_ANON instead, feel free to either comment on the above
bug, or just express them here and I'll proxy them appropriately.

Otherwise, diff below renames MAP_ANON to MAP_ANONYMOUS, and redefines
MAP_ANON as an alias for MAP_ANONYMOUS.


Index: sys/sys/mman.h
===================================================================
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/sys/mman.h,v
retrieving revision 1.25
diff -u -p -r1.25 mman.h
--- sys/sys/mman.h      27 Jun 2014 20:50:43 -0000      1.25
+++ sys/sys/mman.h      27 Jun 2014 21:35:47 -0000
@@ -56,7 +56,8 @@
  */
 #define        MAP_FIXED       0x0010  /* map addr must be exactly as 
requested */
 #define        __MAP_NOREPLACE 0x0800  /* fail if address not available */
-#define        MAP_ANON        0x1000  /* allocated from memory, swap space */
+#define        MAP_ANONYMOUS   0x1000  /* allocated from memory, swap space */
+#define        MAP_ANON        MAP_ANONYMOUS   /* original BSD spelling */
 
 #define        MAP_FLAGMASK    0x1ff7
 
Index: lib/libc/sys/mmap.2
===================================================================
RCS file: /home/matthew/cvs-mirror/cvs/src/lib/libc/sys/mmap.2,v
retrieving revision 1.48
diff -u -p -r1.48 mmap.2
--- lib/libc/sys/mmap.2 27 Jun 2014 22:51:20 -0000      1.48
+++ lib/libc/sys/mmap.2 28 Jun 2014 00:01:25 -0000
@@ -120,7 +120,7 @@ Sharing, mapping type, and options are s
 .Fa flags
 argument by OR'ing the following values.
 Exactly one of the first two values must be specified:
-.Bl -tag -width MAP_PRIVATE -offset indent
+.Bl -tag -width MAP_ANONYMOUS -offset indent
 .It Dv MAP_PRIVATE
 Modifications are private.
 .It Dv MAP_SHARED
@@ -128,11 +128,11 @@ Modifications are shared.
 .El
 .Pp
 Any combination of the following flags may additionally be used:
-.Bl -tag -width MAP_PRIVATE -offset indent
-.It Dv MAP_ANON
+.Bl -tag -width MAP_ANONYMOUS -offset indent
+.It Dv MAP_ANONYMOUS
 Map anonymous memory not associated with any specific file.
 The file descriptor used for creating
-.Dv MAP_ANON
+.Dv MAP_ANONYMOUS
 must currently be \-1 indicating no name is associated with the
 region.
 .It Dv MAP_FIXED
@@ -156,7 +156,16 @@ source compatibility with code written f
 but are not recommended for use in new
 .Ox
 code:
-.Bl -tag -width MAP_PRIVATE -offset indent
+.Bl -tag -width MAP_ANONYMOUS -offset indent
+.It Dv MAP_ANON
+Original name for
+.Dv MAP_ANONYMOUS ,
+as introduced by
+.Bx .
+On
+.Ox
+this is an alias for
+.Dv MAP_ANONYMOUS .
 .It Dv MAP_COPY
 Modifications are private and, unlike
 .Dv MAP_PRIVATE ,

Reply via email to