cgroup_add_cftypes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cgroup_add_cftypes(9) β€” like, the Kernel API Manual page you actually wanna read πŸŽ€

okay bestie, so this is the cgroup_add_cftypes page from section 9 of the Kernel API Manual, and it's lowkey a glow-up moment for your cgroup subsystem. let's get into it ✨


🌸 NAME 🌸

cgroup_add_cftypes β€” add an array of cftypes to a subsystem. that's it, that's the whole vibe. it's giving "here, take these files, they're yours now" 🫢


✨ SYNOPSIS ✨

int cgroup_add_cftypes (struct cgroup_subsys *ss , struct cftype *cfts );

like, you hand it a subsystem and an array of cftypes, and it gives you back an int. simple. iconic. no notes πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • ss β€” the target cgroup subsystem πŸ‘‘ you know, the one getting all the new files.
  • cfts β€” a cftype array that's terminated by a zero-length name. yes, zero-length name terminated β€” that's the little sentinel at the end telling everyone "we're done here, nothing more to see" πŸ™ˆ

πŸ”₯ DESCRIPTION πŸ”₯

So what actually happens? You register cfts to ss. Periodt. πŸ’–

The files described by cfts get created for all existing cgroups that ss is attached to β€” and ngl, every single future cgroup is gonna have them too. no cap. ✨

And the best part? You can call this function anytime β€” whether ss is attached or not. it does not care. it's unbothered. main character energy 🌈

⚠️ okay but read this part carefully bestie:

It returns 0 on successful registration, and -errno on failure. πŸ’€ That's the normal contract, love that for us.

But β€” and this is the part that's lowkey messy β€” this function currently returns 0 as long as the cfts registration was successful, even if some file creation attempts on existing cgroups fail. like, those failures just... happen and don't show up in the return value 😭 so don't assume 0 means every single file popped into existence perfectly. it means the registration itself slayed. that's the distinction, iykyk πŸ“


🧚 SEE ALSO 🧚

like yes, that's a lot of cross-references and no, i did not skip any of them, we don't do that here πŸ’…πŸŒΊ


<div align="center">

🫢 okay that's the page!! this one lives in ./kernel/cgroup, dated October 2026, and it's the cgroup_add_cftypes(9) entry from the Kernel API Manual. go forth and register your cftypes, bestie β€” you're gonna absolutely ate it πŸ’–βœ¨πŸŽ€

</div>

πŸ“¦ where this page comes from