Manual browser: minherit(2)
|MINHERIT(2)||System Calls Manual||MINHERIT(2)|
NAMEminherit — control the inheritance of pages
LIBRARYStandard C Library (libc, -lc)
minherit(void *addr, size_t len, int inherit);
DESCRIPTIONThe 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:
- The child is given a private copy of the region: writes from parent or child are not seen by the other.
- The region is unmapped in the child.
- The child is shares the region with the parent: writes from parent and child are seen by both.
- 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 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.
RETURN VALUESThe 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.
ERRORSminherit() will fail if:
- An invalid region or invalid parameters were specified.
HISTORYThe minherit() function first appeared in OpenBSD.
BUGSIf 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().
|August 5, 2014||NetBSD 7.0|