VM_MAP_FINDSPACE(9)
β¨ VM_MAP_FINDSPACE(9) β¨
okay bestie, so this is a kernel developer's manual page β it's filed under VM_MAP_FINDSPACE(9) in section 9, which is where all the kernel-functions live. Sit down, grab a strawberry π, and let's get into it.
π NAME π
vm_map_findspace β literally just find a free region within a map, no cap
π SYNOPSIS π
first, include the vibe:
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>
then the actual function:
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 out here doing the absolute most: it attempts to find a region inside map that's got enough room for an object of size length at the address addr. that's it. that's the whole job. she's a finder. an icon. π
π¦ IMPLEMENTATION NOTES π¦
okay this part matters, bestie β listen up:
- it is the caller's responsibility to get a lock on the map first, using
vm_map_lock(9), before calling this function. do not skip this. the lock is not a vibe, it's a requirement. π
also:
- this routine may call
pmap_growkernel(9)to grow the kernel's address space β but if and only if the mapping is being made within the kernel address space, and if insufficient space remains in thekernel_map.
like, both conditions. it's giving "conditional queen". π
π₯ RETURN VALUES π₯
- returns the value
0if it works out β slay β and in that case*addrwill contain the first virtual address in the found region - otherwise, the value
1is returned π (no*addrprize for you)
π SEE ALSO π
a whole little friend group fr fr π«Ά
π AUTHORS π
this manual page was written by Bruce M Simpson <bms@spc.org> β ty king π«‘
ngl the one thing to remember: lock the map first withvm_map_lock(9). everything else is just finding space and returning0or1. periodt. π
and that's the whole page, bestie β from the Debian crew, dated July 19, 2003, living in section 9 as VM_MAP_FINDSPACE(9). mwah π go find some space π¦β¨
π¦ 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