find_resource_space(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ find_resource_space β€” a lil kernel API page ✨

okay so this is find_resource_space from the Kernel API Manual (section 9, kernel-space functions, iykyk) πŸ’…


🌸 NAME 🌸

find_resource_space β€” literally just: find empty space in the resource tree πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

int find_resource_space (struct resource *root , struct resource *new ,
resource_size_t size , struct resource_constraint *constraint );

bestie it returns an int, and yes the parameter is named new β€” I know, new is a keyword in other languages, don't come for me, it's C and it's fine 🫢


πŸ’– ARGUMENTS πŸ’–

  • root β€” the root resource descriptor. this is the top of the tree you're searching under, the main character of the whole operation πŸ‘‘
  • new β€” a resource descriptor that is awaiting an empty resource space. it's the one getting placed, the one we're doing all this for πŸ₯Ί
  • size β€” the minimum size of the empty space. no budget for less than this, periodt.
  • constraint β€” the range and alignment constraints that have to be met. it's giving picky, but like, necessarily 🌈

πŸ”₯ DESCRIPTION πŸ”₯

So what it does: it finds an empty space under root in the resource tree that satisfies the range and alignment constraints. that's the whole vibe. it goes looking, it finds a hole that actually fits your requirements, and it's done ✨

no cap, that's it β€” the constraints are doing the heavy lifting here, and size is the floor for how big the hole has to be.


πŸ‘‘ RETURN πŸ‘‘

  • 0 β€” if successful, new members start, end, and flags are altered. yes, it mutates your struct β€” that's the deal, bestie, it's filling in the details for you πŸ’…
  • -EBUSY β€” if no empty space was found. 😭 it looked, nothing fit, that's a wrap.
ngl, -EBUSY here doesn't mean "someone else is using it" in the usual sense β€” it means no empty space was found. don't get it twisted 🫢

🌟 SEE ALSO 🌟

Kernel file ./kernel/resource.c β€” that's where the magic lives, go read it, I'm obsessed 🧚

and the whole resource-management friend group, fr fr:


that's the page, bestie 🌈 this one shipped from the ./kernel source tree, October 2026 edition β€” and the man page itself is find_resource_space(9), so you literally can't lose it. go find some space, slay πŸ’œ

πŸ“¦ where this page comes from