| MINHERIT(2) | System Calls Manual | MINHERIT(2) |
minherit — control
the inheritance of pages
Standard C Library (libc, -lc)
#include
<sys/mman.h>
int
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 determines
how fork(2) will map the region
in the child process. The supported inheritance characteristics are:
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 provided. 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 characteristic 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
error.
minherit() will fail if:
EINVAL]fork(2), madvise(2), mincore(2), mmap(2), mprotect(2), msync(2), munmap(2)
The minherit() function first appeared in
OpenBSD 2.0, then NetBSD
1.3.
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 minherit().
| September 8, 2019 | NetBSD 11.0 |