find_sub_ctxt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ find_sub_ctxt(9) ✨

okay so this is a page from the Kernel API Manual β€” yes bestie, the kernel has lore too πŸ’… and today's main character is find_sub_ctxt. Let's get into it 🫢


🌸 NAME 🌸

find_sub_ctxt β€” fund sub-context

(it's giving "short and mysterious," and honestly? iconic.)


πŸŽ€ SYNOPSIS πŸŽ€

int find_sub_ctxt (struct hfi1_filedata *fd , const struct
       hfi1_user_info *uinfo );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • fd β€” a valid filedata pointer. literally has to be valid, no cap πŸ™ˆ
  • uinfo β€” the matching info you use to find a possible context to share.

πŸ’– DESCRIPTION πŸ’–

So here's the vibe check: the hfi1_mutex must be held when this function is called. Not optional, not "ehhh maybe," it's a whole requirement πŸ”₯

Why? Because it's necessary to ensure serialized creation of shared contexts. Like, no two of them racing in there at the same time β€” we keep that line single-file, periodt πŸ‘‘


⭐ RETURN ⭐

  • 0 β€” no sub-context found πŸ˜”
  • 1 β€” subcontext found and allocated πŸŽ‰ slay
  • errno:
    • EINVAL β€” incorrect parameters πŸ™ˆ
    • EBUSY β€” all sub contexts in use πŸ’€ sorry bestie, they're all taken

🌈 SEE ALSO 🌈

Kernel file ./drivers/infiniband/hw/hfi1/file_ops.c, plus the whole friend group πŸ˜­πŸ’œ


and that's the page, bestie 🧚✨ it lives down in ./drivers/infiniband/hw/hfi1, and this little masterpiece is dated October 2026 β€” future vibes only πŸ“πŸ‘‘ go forth and hold that mutex πŸ’…

πŸ“¦ where this page comes from