xref: /openbsd-src/lib/libc/sys/minherit.2 (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1.\"	$OpenBSD: minherit.2,v 1.13 2007/05/31 19:19:33 jmc 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 $Mdocdate: May 31 2007 $
33.Dt MINHERIT 2
34.Os
35.Sh NAME
36.Nm minherit
37.Nd control the inheritance of pages
38.Sh SYNOPSIS
39.Fd #include <sys/types.h>
40.Fd #include <sys/mman.h>
41.Ft int
42.Fn minherit "void *addr" "size_t len" "int inherit"
43.Sh DESCRIPTION
44The
45.Fn minherit
46system call
47changes the specified pages to have the inheritance characteristic
48.Fa inherit ,
49which can be set to
50.Dv MAP_INHERIT_NONE ,
51.Dv MAP_INHERIT_COPY ,
52or
53.Dv MAP_INHERIT_SHARE .
54Not all implementations will guarantee that the inheritance characteristic
55can be set on a page basis;
56the granularity of changes may be as large as an entire region.
57.Sh RETURN VALUES
58The
59.Fn minherit
60function returns the value 0 if successful;
61otherwise the value \-1 is returned and the global variable
62.Va errno
63is set to indicate the error.
64.Sh ERRORS
65The
66.Fn minherit
67system call will fail if:
68.Bl -tag -width Er
69.It Bq Er EINVAL
70The virtual address range specified by the
71.Fa addr
72and
73.Fa len
74arguments is not valid.
75.It Bq Er EACCES
76The flags specified by the
77.Fa inherit
78argument were not valid for the pages specified
79by the
80.Fa addr
81and
82.Fa len
83arguments.
84.El
85.Sh SEE ALSO
86.Xr madvise 2 ,
87.Xr mincore 2 ,
88.Xr mprotect 2 ,
89.Xr msync 2 ,
90.Xr munmap 2
91.Sh HISTORY
92The
93.Fn minherit
94function first appeared in
95.Ox 2.0 .
96