VM_MAP_FINDSPACE(9)

✨ vm_map_findspace β€” bestie edition ✨

okay so we're in the Kernel Developer's Manual, section 9, and today's main character is vm_map_findspace. she finds free space in a map. that's her whole thing and she's iconic for it πŸ’…


🌸 NAME 🌸

vm_map_findspace β€” find a free region within a map


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>

int
vm_map_findspace(vm_map_t map, vm_offset_t start, vm_size_t length,
    vm_offset_t *addr);

πŸ’– DESCRIPTION πŸ’–

so vm_map_findspace() is literally out here trying to find a region in the map that has enough room for an object of size length at the address addr. that's the vibe. that's the mission. no cap. πŸ¦‹


πŸŽ€ IMPLEMENTATION NOTES πŸŽ€

okay bestie, listen, this part is important so don't scroll past it πŸ™ˆ

it is the caller's responsibility to obtain a lock on the map using vm_map_lock(9) before calling this function. yes, you. the lock is your problem, not hers. handle it. πŸ’…

also, this routine may call pmap_growkernel(9) to grow the kernel's address space β€” but only if and only if the mapping is being made within the kernel address space, and if insufficient space remains in the kernel_map. both conditions, no shortcuts. that's it, that's the rule. ⭐


πŸ’€ RETURN VALUES πŸ’€

  • returns the value 0 if successful β€” and in that happy little case, *addr will contain the first virtual address in the found region πŸ₯³
  • otherwise, the value 1 is returned 😭

periodt. that's the whole return situation.


🫢 SEE ALSO 🫢


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Bruce M Simpson <bms@spc.org>. king behavior, honestly. πŸ’–


and that's the whole page, bestie!! this was the Debian build of VM_MAP_FINDSPACE(9), dated July 19, 2003 β€” yeah she's vintage, she's a classic, we love her for it. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from