Updated: 2022/Sep/29
Please read Privacy Policy. It's for your privacy.
MINHERIT(2) System Calls Manual MINHERIT(2) NAME minherit - control the inheritance of pages LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <sys/mman.h> int minherit(void *addr, size_t len, int inherit); DESCRIPTION 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: MAP_INHERIT_COPY The child is given a private copy of the region: writes from parent or child are not seen by the other. 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 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 VALUES 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. ERRORS minherit() will fail if: [EINVAL] An invalid region or invalid parameters were specified. SEE ALSO fork(2), madvise(2), mincore(2), mmap(2), mprotect(2), msync(2), munmap(2) HISTORY The minherit() function first appeared in OpenBSD 2.0, then NetBSD 1.3. 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 minherit(). NetBSD 10.99 September 8, 2019 NetBSD 10.99