bpf_cgroup_from_id(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– bpf_cgroup_from_id(9) πŸ’–

okay so this is a page from the Kernel API Manual β€” yep, the kernel has its own manual, she's fancy like that β€” and today's main character is bpf_cgroup_from_id, a kfunc that goes and finds you a cgroup if you hand it the right ID. πŸŽ€


✨ NAME ✨

bpf_cgroup_from_id β€” find a cgroup from its ID.

Real talk though, bestie, this is the part you cannot skip: a cgroup returned by this kfunc which is not subsequently stored in a map must be released by calling bpf_cgroup_release(). So if you're not immediately tucking that cgroup into a map, you gotta clean up after yourself. No leaving it lying around. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

__bpf_kfunc struct cgroup * bpf_cgroup_from_id (u64 cgid );

That's the whole vibe: you give it a u64, you get back a struct cgroup *. Slay. ✨


🌸 ARGUMENTS 🌸

  • cgid β€” the cgroup id. that's it, that's the argument. hand over the id, get a cgroup (and remember the release rule up top, ok? 🫢).

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./kernel/bpf/helpers.c, plus literally the entire squad β€” these kfuncs all hang out together so here's the full friend group, no gatekeeping:


🫢 friendly reminder, one last time, because it matters: not stored in a map? then call bpf_cgroup_release(). periodt. πŸ’€

and that's the page, diva πŸ’œ β€” brought to you by the source path ./kernel/bpf, dated October 2026, filed under bpf_cgroup_from_id(9). go forth and release your cgroups 🌈⭐

πŸ“¦ where this page comes from