MAC_IS_PRESENT(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… MAC_IS_PRESENT πŸ’…

ok so bestie, welcome to mac_is_present β€” it's section 3 of the manual, and it lives in the Standard C Library (libc, link it with -lc). Its whole entire job? Telling you whether the system you're running on right now has MAC support. That's it. That's the gig. πŸ‘‘


✨ NAME ✨

mac_is_present β€” report whether the running system has MAC support. literally just a yes/no girlie, and she does it flawlessly. πŸŽ€


🌸 LIBRARY 🌸

Standard C Library (libc, -lc) β€” she's built in, no extra downloads, no cap. 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <sys/mac.h>

int
mac_is_present(const char *policyname);

that's the whole incantation, mwah πŸ’‹


πŸ’œ DESCRIPTION πŸ’œ

okay so mac_is_present() is the function that determines whether the currently-running kernel supports MAC for a given policy or not. vibe check on the kernel itself. 😌

Here's the tea on the argument:

  • If policyname is non-NULL, then the presence of the named policy gets checked β€” think names like "biba", "mls", "te". πŸ‘€
  • If policyname is NULL, then it checks the presence of any MAC policies at all. like, does this system have any MAC energy whatsoever? 🌈

πŸ”₯ RETURN VALUES πŸ”₯

  • 1 β€” slay! the system supports the given MAC policy. βœ…
  • 0 β€” nope, the specified MAC policy is not supported. πŸ’€
  • -1 β€” something went wrong, an error occurred. 😭

πŸ™ˆ ERRORS πŸ™ˆ

  • [EINVAL] β€” the value of policyname is not valid. bestie what did you even type 😭
  • [ENOMEM] β€” insufficient memory was available to allocate internal storage. the system is out of room, no notes 🫠

⭐ SEE ALSO ⭐

the whole friend group, go say hi:


🧚 HISTORY 🧚

Support for Mandatory Access Control was introduced in FreeBSD 5.0 as part of the TrustedBSD Project. iconic behavior honestly, we love a glow-up origin story 🌟


and that's the page!! this beauty shipped with Debian, dated July 7, 2006 β€” yes she's an elder but she's still serving πŸ’…πŸ’– bye bestie, go check your policies πŸ¦‹

πŸ“¦ where this page comes from