- NetBSD Manual Pages
MINHERIT(2) NetBSD System Calls Manual MINHERIT(2)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
minherit -- control the inheritance of pages
Standard C Library (libc, -lc)
minherit(void *addr, size_t len, int inherit);
The minherit() system call changes the specified range of virtual
addresses to have the inheritance characteristic inherit, which deter-
mines how fork(2) will map the region in the child process. The sup-
ported inheritance characteristics are:
MAP_INHERIT_COPY The child is given a private copy of the region:
writes from parent or child are not seen by the
MAP_INHERIT_NONE The region is unmapped in the child.
MAP_INHERIT_SHARE The child is shares the region with the parent:
writes from parent and child are seen by both.
MAP_INHERIT_ZERO The region is mapped in the child to anonymous
pages filled with zeros.
Normally, the parent's virtual address space is copied for the child as
if with MAP_INHERIT_COPY, for which the alias MAP_INHERIT_DEFAULT is pro-
vided. Regions in the parent mapped using mmap(2) with the MAP_SHARED
flag are by default shared with the child as if with MAP_INHERIT_SHARED.
Not all implementations will guarantee that the inheritance characteris-
tic can be set on a page basis; the granularity of changes may be as
large as an entire region.
The minherit() function returns the value 0 if successful; otherwise the
value -1 is returned and the global variable errno is set to indicate the
minherit() will fail if:
[EINVAL] An invalid region or invalid parameters were speci-
fork(2), madvise(2), mincore(2), mmap(2), mprotect(2), msync(2),
The minherit() function first appeared in OpenBSD.
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
NetBSD 9.3 August 5, 2014 NetBSD 9.3