etc/services - sync with NetBSD-8
[minix.git] / lib / libc / sys / minherit.2
blobfa89a6455ae71c9f1d45437ccab82747199d2a4d
1 .\"     $NetBSD: minherit.2,v 1.20 2014/08/05 15:01:03 riastradh Exp $
2 .\"
3 .\" Copyright (c) 1991, 1993
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\"    may be used to endorse or promote products derived from this software
16 .\"    without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\"     @(#)minherit.2  8.1 (Berkeley) 6/9/93
31 .\"
32 .Dd August 5, 2014
33 .Dt MINHERIT 2
34 .Os
35 .Sh NAME
36 .Nm minherit
37 .Nd control the inheritance of pages
38 .Sh LIBRARY
39 .Lb libc
40 .Sh SYNOPSIS
41 .In sys/mman.h
42 .Ft int
43 .Fn minherit "void *addr" "size_t len" "int inherit"
44 .Sh DESCRIPTION
45 The
46 .Fn minherit
47 system call changes the specified range of virtual addresses to have
48 the inheritance characteristic
49 .Fa inherit ,
50 which determines how
51 .Xr fork 2
52 will map the region in the child process.
53 The supported inheritance characteristics are:
54 .Bl -tag -offset abcd -width MAP_INHERIT_DEFAULT
55 .It MAP_INHERIT_COPY
56 The child is given a private copy of the region: writes from parent or
57 child are not seen by the other.
58 .It MAP_INHERIT_NONE
59 The region is unmapped in the child.
60 .It MAP_INHERIT_SHARE
61 The child is shares the region with the parent: writes from parent and
62 child are seen by both.
63 .It MAP_INHERIT_ZERO
64 The region is mapped in the child to anonymous pages filled with
65 zeros.
66 .El
67 .Pp
68 Normally, the parent's virtual address space is copied for the child
69 as if with
70 .Dv MAP_INHERIT_COPY ,
71 for which the alias
72 .Dv MAP_INHERIT_DEFAULT
73 is provided.
74 Regions in the parent mapped using
75 .Xr mmap 2
76 with the
77 .Dv MAP_SHARED
78 flag are by default shared with the child as if with
79 .Dv MAP_INHERIT_SHARED .
80 .Pp
81 Not all implementations will guarantee that the inheritance characteristic
82 can be set on a page basis;
83 the granularity of changes may be as large as an entire region.
84 .Sh RETURN VALUES
85 .Rv -std minherit
86 .Sh ERRORS
87 .Fn minherit
88 will fail if:
89 .Bl -tag -width Er
90 .It Bq Er EINVAL
91 An invalid region or invalid parameters were specified.
92 .El
93 .Sh SEE ALSO
94 .Xr fork 2 ,
95 .Xr madvise 2 ,
96 .Xr mincore 2 ,
97 .Xr mmap 2 ,
98 .Xr mprotect 2 ,
99 .Xr msync 2 ,
100 .Xr munmap 2
101 .Sh HISTORY
103 .Fn minherit
104 function first appeared in
105 .Ox .
106 .Sh BUGS
107 If a particular port does not support page-granularity
108 inheritance, there's no way to figure out how large a region is
109 actually affected by
110 .Fn minherit .