aa_set_current_hat(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

Okay so welcome to aa_set_current_hat(9), straight from the Kernel API Manual β€” and the name is literally aa_set_current_hat, aka set the current tasks hat. Slay, we love a clear title πŸ’…


✨ SYNOPSIS ✨

int aa_set_current_hat (struct aa_label *label , u64 token );

πŸŽ€ ARGUMENTS πŸŽ€

  • label β€” the label to set as the current hat, and bestie it is NOT NULL. No cap, it has to be there 🫢
  • token β€” the token value that must be specified to change from the hat. That’s the little key situation πŸ”‘

🌸 DESCRIPTION 🌸

It does the switch of the task’s hat. Periodt.

If the task is currently in a hat, it validates the token to match. So yeah, the token has to line up β€” vibe check passed or it’s not moving πŸ’€


πŸ”₯ RETURN πŸ”₯

Returns 0 or error on failure. That’s the whole mood: success gets a 0, failure gets an error 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./security/apparmor/task.c β€” go peek at the source, iykyk πŸ‘€


Later bestie 🫢 β€” this page’s source/version is ./security/apparmor, and the date on it is October 2026. aa_set_current_hat(9) out πŸ’…βœ¨

πŸ“¦ where this page comes from