xref: /minix3/lib/libc/sys/minherit.2 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: minherit.2,v 1.20 2014/08/05 15:01:03 riastradh Exp $
22fe8fb19SBen Gras.\"
32fe8fb19SBen Gras.\" Copyright (c) 1991, 1993
42fe8fb19SBen Gras.\"	The Regents of the University of California.  All rights reserved.
52fe8fb19SBen Gras.\"
62fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without
72fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions
82fe8fb19SBen Gras.\" are met:
92fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright
102fe8fb19SBen Gras.\"    notice, this list of conditions and the following disclaimer.
112fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
122fe8fb19SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
132fe8fb19SBen Gras.\"    documentation and/or other materials provided with the distribution.
142fe8fb19SBen Gras.\" 3. Neither the name of the University nor the names of its contributors
152fe8fb19SBen Gras.\"    may be used to endorse or promote products derived from this software
162fe8fb19SBen Gras.\"    without specific prior written permission.
172fe8fb19SBen Gras.\"
182fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
192fe8fb19SBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
202fe8fb19SBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
212fe8fb19SBen Gras.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
222fe8fb19SBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
232fe8fb19SBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
242fe8fb19SBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
252fe8fb19SBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
262fe8fb19SBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
272fe8fb19SBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
282fe8fb19SBen Gras.\" SUCH DAMAGE.
292fe8fb19SBen Gras.\"
302fe8fb19SBen Gras.\"	@(#)minherit.2	8.1 (Berkeley) 6/9/93
312fe8fb19SBen Gras.\"
32*0a6a1f1dSLionel Sambuc.Dd August 5, 2014
332fe8fb19SBen Gras.Dt MINHERIT 2
342fe8fb19SBen Gras.Os
352fe8fb19SBen Gras.Sh NAME
362fe8fb19SBen Gras.Nm minherit
372fe8fb19SBen Gras.Nd control the inheritance of pages
382fe8fb19SBen Gras.Sh LIBRARY
392fe8fb19SBen Gras.Lb libc
402fe8fb19SBen Gras.Sh SYNOPSIS
412fe8fb19SBen Gras.In sys/mman.h
422fe8fb19SBen Gras.Ft int
432fe8fb19SBen Gras.Fn minherit "void *addr" "size_t len" "int inherit"
442fe8fb19SBen Gras.Sh DESCRIPTION
452fe8fb19SBen GrasThe
462fe8fb19SBen Gras.Fn minherit
47*0a6a1f1dSLionel Sambucsystem call changes the specified range of virtual addresses to have
48*0a6a1f1dSLionel Sambucthe inheritance characteristic
492fe8fb19SBen Gras.Fa inherit ,
50*0a6a1f1dSLionel Sambucwhich determines how
51*0a6a1f1dSLionel Sambuc.Xr fork 2
52*0a6a1f1dSLionel Sambucwill map the region in the child process.
53*0a6a1f1dSLionel SambucThe supported inheritance characteristics are:
54*0a6a1f1dSLionel Sambuc.Bl -tag -offset abcd -width MAP_INHERIT_DEFAULT
55*0a6a1f1dSLionel Sambuc.It MAP_INHERIT_COPY
56*0a6a1f1dSLionel SambucThe child is given a private copy of the region: writes from parent or
57*0a6a1f1dSLionel Sambucchild are not seen by the other.
58*0a6a1f1dSLionel Sambuc.It MAP_INHERIT_NONE
59*0a6a1f1dSLionel SambucThe region is unmapped in the child.
60*0a6a1f1dSLionel Sambuc.It MAP_INHERIT_SHARE
61*0a6a1f1dSLionel SambucThe child is shares the region with the parent: writes from parent and
62*0a6a1f1dSLionel Sambucchild are seen by both.
63*0a6a1f1dSLionel Sambuc.It MAP_INHERIT_ZERO
64*0a6a1f1dSLionel SambucThe region is mapped in the child to anonymous pages filled with
65*0a6a1f1dSLionel Sambuczeros.
66*0a6a1f1dSLionel Sambuc.El
67*0a6a1f1dSLionel Sambuc.Pp
68*0a6a1f1dSLionel SambucNormally, the parent's virtual address space is copied for the child
69*0a6a1f1dSLionel Sambucas if with
702fe8fb19SBen Gras.Dv MAP_INHERIT_COPY ,
71*0a6a1f1dSLionel Sambucfor which the alias
72*0a6a1f1dSLionel Sambuc.Dv MAP_INHERIT_DEFAULT
73*0a6a1f1dSLionel Sambucis provided.
74*0a6a1f1dSLionel SambucRegions in the parent mapped using
75*0a6a1f1dSLionel Sambuc.Xr mmap 2
76*0a6a1f1dSLionel Sambucwith the
77*0a6a1f1dSLionel Sambuc.Dv MAP_SHARED
78*0a6a1f1dSLionel Sambucflag are by default shared with the child as if with
79*0a6a1f1dSLionel Sambuc.Dv MAP_INHERIT_SHARED .
80*0a6a1f1dSLionel Sambuc.Pp
812fe8fb19SBen GrasNot all implementations will guarantee that the inheritance characteristic
822fe8fb19SBen Grascan be set on a page basis;
832fe8fb19SBen Grasthe granularity of changes may be as large as an entire region.
842fe8fb19SBen Gras.Sh RETURN VALUES
852fe8fb19SBen Gras.Rv -std minherit
862fe8fb19SBen Gras.Sh ERRORS
872fe8fb19SBen Gras.Fn minherit
882fe8fb19SBen Graswill fail if:
892fe8fb19SBen Gras.Bl -tag -width Er
902fe8fb19SBen Gras.It Bq Er EINVAL
912fe8fb19SBen GrasAn invalid region or invalid parameters were specified.
922fe8fb19SBen Gras.El
932fe8fb19SBen Gras.Sh SEE ALSO
942fe8fb19SBen Gras.Xr fork 2 ,
952fe8fb19SBen Gras.Xr madvise 2 ,
962fe8fb19SBen Gras.Xr mincore 2 ,
97*0a6a1f1dSLionel Sambuc.Xr mmap 2 ,
982fe8fb19SBen Gras.Xr mprotect 2 ,
992fe8fb19SBen Gras.Xr msync 2 ,
1002fe8fb19SBen Gras.Xr munmap 2
1012fe8fb19SBen Gras.Sh HISTORY
1022fe8fb19SBen GrasThe
1032fe8fb19SBen Gras.Fn minherit
1042fe8fb19SBen Grasfunction first appeared in
1052fe8fb19SBen Gras.Ox .
1062fe8fb19SBen Gras.Sh BUGS
1072fe8fb19SBen GrasIf a particular port does not support page-granularity
1082fe8fb19SBen Grasinheritance, there's no way to figure out how large a region is
1092fe8fb19SBen Grasactually affected by
1102fe8fb19SBen Gras.Fn minherit .
111