VM_MAP_SUBMAP(9)
π« VM_MAP_SUBMAP π«
okay bestie, welcome to section 9 of the Kernel Developer's Manual β we're deep in kernel land today and honestly? it's giving wizard energy π§ββοΈβ¨
πΈ NAME πΈ
vm_map_submap β create a subordinate map (yes, a whole baby map inside your map, we love a nested situation π)
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>
int
vm_map_submap(vm_map_t map, vm_offset_t start, vm_offset_t end,
vm_map_t submap);
π DESCRIPTION π
so here's the tea, bestie: vm_map_submap() takes the range that's bounded by start and end inside the map map, and marks it as being handled by a subordinate map called sub_map. literally handing off a chunk of your map to a smaller map like "here girl, you take this one" π«Ά
and who's out here calling this? mostly the kernel memory allocator, no cap. it's their little helper function.
π§ IMPLEMENTATION NOTES π§
β οΈ okay this part is important, don't skip it
- this function is for internal use only. like, it's not a public-facing slay, it's an internal-use-only slay π
- both maps must exist. you can't just vibe with a nonexistent map, that's not the move.
- the range must have been created with
vm_map_find(9)beforehand. prior setup is mandatory, periodt. - no other operations may have been performed on this range before you call this function. none. zero. clean slate only π
- after you call this function, only the
vm_fault()operation may be performed within this range. that's the one and only thing allowed in there afterward, iykyk. - wanna remove a submapping? okay so: first you have to remove the range from the parent map, and then destroy the
sub_map. that's the order, no shortcuts. - > π¨ and just so we're clear: this removal procedure is not recommended. like, the manpage literally says don't. soβ¦ don't. π
π RETURN VALUES π
KERN_SUCCESSβ returned if it worked! iconic, no notes πKERN_INVALID_ARGUMENTβ returned otherwise, and here's when:- the caller requested copy-on-write flags π
- the range you specified for the sub-map was out of range for the parent map π
- a
NULLbacking object was specified π
π₯ SEE ALSO π₯
π AUTHORS π
this manual page was written by Bruce M Simpson <bms@spc.org>. ty bestie for the docs, we appreciate you fr fr π
and that's the whole page, bestie! this one's from the Debian crew and it's dated July 19, 2003 β a vintage classic, honestly, and it still ate πΈβ¨π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms