__cgroup_bpf_detach(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __cgroup_bpf_detach β€” the kernel API manual, bestie edition ✨

Okay so real talk, we're in the Kernel API Manual today and the main character is __cgroup_bpf_detach(9). Yes, that's a mouthful, yes it's lowkey iconic, no we're not skipping anything. Sit down, grab a lil drink, let's get into it πŸ“


🌸 NAME 🌸

__cgroup_bpf_detach β€” detaches the program or the link from a cgroup, and then propagates the change to descendants. Like, the whole family tree gets the update, no cap.


✨ SYNOPSIS ✨

int __cgroup_bpf_detach (struct cgroup *cgrp , struct bpf_prog *prog ,
       struct bpf_cgroup_link *link , enum bpf_attach_type type , u64 revision
);

Copy it exactly, bestie, we do not freestyle signatures around here πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • cgrp β€” the cgroup whose descendants we're gonna traverse. Think of it as the group chat you're sending the message to, and yes the whole thread reads it 🫢
  • prog β€” a program to detach, or NULL. That's it, that's the vibe.
  • link β€” a link to detach, or NULL. Same deal, choose your fighter.
  • type β€” the type of detach operation. Keeping it specified, periodt.
  • revision β€” the bpf_prog_list revision. Numbers matter, always.

πŸ’– DESCRIPTION πŸ’–

So here's the tea β˜•: at most one of prog or link can be non-NULL. Not both. Never both. We don't do that here πŸ™ˆ

And this is the part where I have to be dramatic: it must be called with cgroup_mutex held. That's not a suggestion, that's not a cute optional extra, that's a requirement. Hold the mutex. Forever. Okay not forever but like, during the call. πŸ”₯

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./kernel/bpf/cgroup.c β€” go read it, it's giving main character energy:


🌈 Sign-off 🌈

That's the whole page, bestie, you ate πŸ’…βœ¨ This little gem lives in ./kernel/bpf, it's dated October 2026, and you can find it filed under __cgroup_bpf_detach(9). Go forth and detach responsibly πŸ§šπŸ’œ

πŸ“¦ where this page comes from