__label_replace(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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

okay bestie, so this is a page from the Kernel API Manual, and it's literally about swapping one label for another inside a label set. that's the whole vibe. πŸŽ€


✨ NAME ✨

__label_replace β€” replace @old with @new in label set

like... the name is literally the plot. no notes. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

bool __label_replace (struct aa_label *old , struct aa_label *new );

it returns a bool, it takes two struct aa_label * args, and the spacing in there is exactly what the manpage says, so don't come for me about it fr fr πŸ’…


🌸 ARGUMENTS 🌸

  • old β€” the label you're yeeting out of the label set. bye bestie πŸ‘‹
  • new β€” the label that's taking old's spot, like a glow-up replacement. slay ✨

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the requirement, and it's giving strict: you need labels_set(old)->lock write_lock valid, and a ref count must be held on new.

read that again. write lock on the labels_set of old, and a valid ref count held on new. that's the entry fee, no exceptions 🫢


⭐ RETURN ⭐

returns true if old was actually in the set and got replaced by new.

if it wasn't in the set? then it's not true. simple as that πŸ’€


🧚 NOTE 🧚

heads up bestie β€” the current implementation requires the label set be ordered in such a way that new directly replaces old's position in the set. like, the position has to line up.

and specifically: ie. using pointer comparison of the label address would not work. so don't try that. it's not gonna eat, it's gonna flop πŸ™ˆ


πŸ“ SEE ALSO πŸ“

the whole friend group, in the order the manpage gives them, and yes i'm listing every single one because i'm not about to do you dirty like that πŸ’œ


and that's the page!! πŸŽ€ this whole thing lives under ./security/apparmor, and it's dated October 2026 in the <pink>Kernel API Manual</pink> β€” so yeah, future-dated and iconic. go replace some labels bestie, but hold that write lock first πŸ˜­πŸ’–πŸ¦‹

πŸ“¦ where this page comes from