AUDIT_NAME_TO_ACTION(3)

πŸ’– AUDIT_NAME_TO_ACTION(3) πŸ’–

okay so bestie, welcome to the Linux Audit API corner of the manual, and today we're doing the name ↔ number glow-up for audit actions ✨


🌸 NAME 🌸

audit_name_to_action, audit_action_to_name β€” the two functions that convert an action name to the numeric action value, and right back again. like a little translation service, but for audit actions πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <libaudit.h>

int audit_name_to_action(const char *action);

const char *audit_action_to_name(int action);

✨ DESCRIPTION ✨

okay so, audit_name_to_action() takes the action name β€” that's "never", "possible", or "always" β€” and converts it to the numeric action value, which is AUDIT_NEVER, AUDIT_POSSIBLE, or AUDIT_ALWAYS πŸ’…

and action? that's the action name. periodt.


audit_action_to_name() is literally the reverse queen πŸ‘‘ she takes the numeric action value β€” AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS β€” and converts it to the action name: "never", "possible", "always" 🌈

and action here is the numeric action value 🫢


πŸ’€ RETURN VALUE πŸ’€

okay listen, this part matters:

  • audit_name_to_action() returns -1 if an error occurs; otherwise, the return value is the numeric action value. not me being dramatic but -1 means something went wrong fr fr 😭
  • audit_action_to_name() returns NULL if an error occurs; otherwise, the return value is the action name. NULL is the vibe check fail, bestie πŸ’€
the way that error checking is not optional β€” always check your return value before you use it, iykyk 🧚

🌟 AUTHOR 🌟

Steve Grubb β€” iconic, we love him, no cap πŸ’œ


and that's the whole page bestie!! πŸ“ this was the Linux Audit API manual, brought to you by Red Hat, dated Mar 2022 β€” like, that's the source, the version and the date, all wrapped up in a cute little bow πŸŽ€ mwah, slay, see u in the next manpage πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from