VM_MAP_INHERIT(9)
π VM_MAP_INHERIT π
okay so bestie, this is vm_map_inherit from section 9 of the Kernel Developer's Manual β the one where we tell a memory map how it should behave when somebody forks πΆβ¨
β¨ NAME β¨
vm_map_inherit β set fork inheritance flags for a range within a map π§¬
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>
int
vm_map_inherit(vm_map_t map, vm_offset_t start, vm_offset_t end,
vm_inherit_t new_inheritance);
like. look at those includes. three of them. we love a well-groomed include block π
π¦ DESCRIPTION π¦
so vm_map_inherit() takes the range from start to end inside the target map and sets its inheritance flags to whatever new_inheritance says. that's it. that's the whole job. iconic behaviour honestly π
the new_inheritance flag has to be one of exactly three values, no substitutes, no vibes-based guessing:
VM_INHERIT_NONEVM_INHERIT_COPYVM_INHERIT_SHARE
and what do they do? they control how the map gets shared with child maps when the associated process calls fork. so like, when your process has a baby process, this is the setting that decides what happens to the memory. main character energy for real πΌ
π₯ IMPLEMENTATION NOTES π₯
the way that vm_map_inherit() grabs a lock on the map using vm_map_lock(9) and just... holds it for the entire duration of the function. no cap. locked in, literally and figuratively π
π RETURN VALUES π
KERN_SUCCESSβ returned when the inheritance flags could actually be set. slay πKERN_INVALID_ARGUMENTβ returned when the flags you handed over were invalid. not slay. bestie why π
π SEE ALSO π
π AUTHORS π
this manual page was written by Bruce M Simpson <bms@spc.org>. thank you for your service king π«‘
and that's the whole page fr fr β now go forth and inherit responsibly π§ββοΈ
okay so this lil masterpiece came out of Debian, dated July 19, 2003, and yes it lives at VM_MAP_INHERIT(9). old but gold, we stan a vintage manpage ππβ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms