avc_add_callback(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… avc_add_callback(9) β€” like, the Kernel API Manual era 🫢

okay so bestie, strap in, because this one is short and sweet but it's literally all about registering a callback for security events and honestly? iconic behaviour. this is a page from the avc_add_callback(9) end of the Kernel API Manual, and yes we are absolutely gonna read it together πŸ’–


✨ NAME ✨

avc_add_callback β€” Register a callback for security events.

like. that's the whole vibe. you're signing a function up to get pinged when security stuff goes down. no cap. πŸ‘‘


🌸 SYNOPSIS 🌸

int avc_add_callback (int (*callback)(u32 event) , u32 events );

copy it exactly, bestie, character for character, because the compiler does not accept vibes as an argument 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • callback β€” the callback function itself. your little guy. the function that gets called. it takes a u32 event. slay.
  • events β€” the security events. this is the set of events you're registering for, so think of it as the guest list for your callback's party πŸ’Œ

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” you call this and it registers a callback function for events in the set events. one function, one set of events, one beautiful little agreement between you and the kernel 🀝

and the returns? very demure, very mindful:

  • returns 0 on success ✨
  • returns -ENOMEM if insufficient memory exists to add the callback πŸ’€

that's it. that's the whole function. lowkey obsessed with how straightforward this is. no hidden lore, no surprises, just memory permitting and you're in πŸ’œ

ngl, if you get -ENOMEM back it's not a you problem, it's a memory problem. the kernel just didn't have enough room to add your callback. respect the boundary πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, fr fr β€” these all live in the kernel file ./security/selinux/avc.c:

go read them all, i'll wait πŸ’…


mwah πŸ’‹ that's the page!! brought to you by the fine people at ./security/selinux, dated October 2026, and of course the star of the show herself, avc_add_callback(9). πŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from