Hi Matthew, so in a nutshell, mmap(2) was originally a BSD idea and first implemented in SunOS? And there is no doubt that *BSD always had MAP_ANON and never MAP_ANONYMOUS and that SunOS primarily defines MAP_ANON and MAP_ANONYMOUS only for "/* (source compatibility) */", right? And that the earliest occurence of MAP_ANONYMOUS we found so far is Linux (1994)? And that 4.4BSD was released with MAP_ANON before that (1993)...
That does look like a bunch of arguments for the POSIX crowd to swallow, i think. Besides, i dug up some more. Matthew Dempsky wrote on Mon, Jun 30, 2014 at 01:57:20PM -0700: > mmap() "first appeared" in 4.1cBSD [mmap.2] and was scheduled for > inclusion in 4.2BSD (1983) [UVM thesis, p36], but didn't "actually > appear" until the 1993 4.4BSD release [UVM thesis, p36]. At least MAP_ANON is definitely a lot older than 1993. The original CSRG commit introducing it looks like this: sys/sys/SCCS/s.mman.h: As 00038/00013/00010 Ad D 7.2 90/12/05 15:28:56 mckusick 6 5 Ac update for new VM And that commit did make it into the 4.3BSD Net/2 release, published on August 20, 1991 (as seen on Kirk's CSRG archive CD). So i'd challenge anybody arguing for MAP_ANONYMOUS to show a published <sys/mman.h> header file containing that spelling where it was introduced before December 5, 1990. Yours, Ingo Here is version 6 of BSD <sys/mman.h> as of December 5, 1990: /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * * %sccs.include.redist.c% * * %W% (Berkeley) %G% */ /* * Protections are chosen from these bits, or-ed together */ #define PROT_READ 0x04 /* pages can be read */ #define PROT_WRITE 0x02 /* pages can be written */ #define PROT_EXEC 0x01 /* pages can be executed */ /* * Flags contain mapping type, sharing type and options. * Mapping type; choose one */ #define MAP_FILE 0x0001 /* mapped from a file or device */ #define MAP_ANON 0x0002 /* allocated from memory, swap space */ #define MAP_TYPE 0x000f /* mask for type field */ /* * Sharing types; choose one */ #define MAP_COPY 0x0020 /* "copy" region at mmap time */ #define MAP_SHARED 0x0010 /* share changes */ #define MAP_PRIVATE 0x0000 /* changes are private */ /* * Other flags */ #define MAP_FIXED 0x0100 /* map addr must be exactly as requested */ #define MAP_NOEXTEND 0x0200 /* for MAP_FILE, don't change file size */ #define MAP_HASSEMPHORE 0x0400 /* region may contain semaphores */ #define MAP_INHERIT 0x0800 /* region is retained after exec */ /* * Advice to madvise */ #define MADV_NORMAL 0 /* no further special treatment */ #define MADV_RANDOM 1 /* expect random page references */ #define MADV_SEQUENTIAL 2 /* expect sequential page references */ #define MADV_WILLNEED 3 /* will need these pages */ #define MADV_DONTNEED 4 /* dont need these pages */