Home | History | Annotate | Line # | Download | only in sys
 $NetBSD: minherit.2,v 1.21 2019/09/08 17:47:33 sevan Exp $

Copyright (c) 1991, 1993
The Regents of the University of California. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

@(#)minherit.2 8.1 (Berkeley) 6/9/93

.Dd September 8, 2019 .Dt MINHERIT 2 .Os .Sh NAME .Nm minherit .Nd control the inheritance of pages .Sh LIBRARY .Lb libc .Sh SYNOPSIS n sys/mman.h .Ft int .Fn minherit "void *addr" "size_t len" "int inherit" .Sh DESCRIPTION The .Fn minherit system call changes the specified range of virtual addresses to have the inheritance characteristic .Fa inherit , which determines how .Xr fork 2 will map the region in the child process. The supported inheritance characteristics are: l -tag -offset abcd -width MAP_INHERIT_DEFAULT t MAP_INHERIT_COPY The child is given a private copy of the region: writes from parent or child are not seen by the other. t MAP_INHERIT_NONE The region is unmapped in the child. t MAP_INHERIT_SHARE The child is shares the region with the parent: writes from parent and child are seen by both. t MAP_INHERIT_ZERO The region is mapped in the child to anonymous pages filled with zeros. .El

p Normally, the parent's virtual address space is copied for the child as if with .Dv MAP_INHERIT_COPY , for which the alias .Dv MAP_INHERIT_DEFAULT is provided. Regions in the parent mapped using .Xr mmap 2 with the .Dv MAP_SHARED flag are by default shared with the child as if with .Dv MAP_INHERIT_SHARED .

p Not all implementations will guarantee that the inheritance characteristic can be set on a page basis; the granularity of changes may be as large as an entire region. .Sh RETURN VALUES .Rv -std minherit .Sh ERRORS .Fn minherit will fail if: l -tag -width Er t Bq Er EINVAL An invalid region or invalid parameters were specified. .El .Sh SEE ALSO .Xr fork 2 , .Xr madvise 2 , .Xr mincore 2 , .Xr mmap 2 , .Xr mprotect 2 , .Xr msync 2 , .Xr munmap 2 .Sh HISTORY The .Fn minherit function first appeared in .Ox 2.0 , then .Nx 1.3 . .Sh BUGS If a particular port does not support page-granularity inheritance, there's no way to figure out how large a region is actually affected by .Fn minherit .