Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2000 15:09:24 +0200
From:      Thomas Klausner <wiz@netbsd.org>
To:        freebsd-arch@freebsd.org, freebsd-hackers@freebsd.org, tech-kern@netbsd.org, tech@openbsd.org
Cc:        wiz@netbsd.org
Subject:   minherit(2) API
Message-ID:  <20000709150924.N23637@danbala.tuwien.ac.at>

next in thread | raw e-mail | index | archive | help
Hi,

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

  We propose the addition of these constant definitions to sys/mman.h
to avoid requiring the inclusion of kernel internal vm header files.
We propose the renaming of these constants from VM_INHERIT_ to
MAP_INHERIT_ to avoid name space pollution (the MAP_ prefix is
reserved for sys/mman.h by POSIX, VM_ is not).

  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.


  The current state of affairs on each system:

  FreeBSD: synopsis:

	#include <sys/types.h>
	#include <sys/mman.h>

	int minherit(void *addr, size_t len, int inherit);

VM_INHERIT_ constants are neither documented nor declared in any user
header.

  NetBSD: synopsis:

	#include <sys/types.h>
	#include <sys/mman.h>

	int minherit(void *addr, size_t len, int inherit);

VM_INHERIT_ constants are not declared in any user header.

  OpenBSD: synopsis:

	#include <sys/types.h>
	#include <sys/mman.h>
	#include <vm/vm_inherit.h>

	int minherit(void *addr, size_t len, int inherit);

vm/vm_inherit.h does not declare the type vm_inherit_t (but uses it
for the definition of the VM_INHERIT_ constants); furthermore,
vm/vm_inherit.h is an internal kernel header.


I wasn't sure which FreeBSD mailing list is more appropriate, so I
took both. Please CC: any answers to the other lists, too.

Bye,
 Thomas Klausner

-- 
Thomas Klausner - wiz@netbsd.org
I wanted to emulate some of my heroes, but I didn't know their
op-codes. --dowe


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000709150924.N23637>