Subject: Re: minherit(2) API
To: Thomas Klausner <wiz@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 07/11/2000 22:12:36
On Sun, Jul 09, 2000 at 03:09:24PM +0200, Thomas Klausner wrote:

 > The user API for minherit(2) is broken on all three of
 > {Free,Net,Open}BSD, but broken differently (for details see end of
 > this mail).  We would like to see a common fix that allows minherit to
 > be used portably across the three systems.
 > 
 >   The API we propose:
 > 
 >   synopsis for minherit:
 > 
 > 	#include <sys/mman.h>
 > 
 > 	int minherit(void *addr, size_t len, int inherit);
 > 
 >   constants for inherit parameter defined in sys/mman.h:
 > 
 > 	#define MAP_INHERIT_SHARE        0      /* share with child */
 > 	#define MAP_INHERIT_COPY         1      /* copy into child */
 > 	#define MAP_INHERIT_NONE         2      /* absent from child */
 > 
 > possibly including the following:
 > 
 > 	#define MAP_INHERIT_DONATE_COPY  3      /* copy and delete */
 > 	#define MAP_INHERIT_DEFAULT      MAP_INHERIT_COPY
 > 	
 > (donate copy is not present in FreeBSD, default is not documented in
 > the man pages of any of the three).

DONATE_COPY is not implemented in UVM.  I'm not sure it was ever
implemented anywhere.  "Copy and delete" is really "move", right?
Anyway, it's not clear those semantics are really useful at all.

 >   That this change is not backwards compatible is of little concern,
 > since it is currently broken anyway.  Besides, a C program can check
 > for the definition of the MAP_INHERIT_ constants after including
 > sys/mman.h and include conditional workarounds for the current APIs.

It can certainly be made ABI-compatible.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>