ACL_GET_PERM(3)

πŸ’… ACL_GET_PERM β€” bestie's guide to peeking at permissions

okay so this is a page from ACL_GET_PERM(3), aka section 3 of the Library Functions Manual, and it's literally just "does this permission set contain this one permission?" no cap. it's giving tiny function, huge main character energy. let's go πŸ¦‹


✨ NAME ✨

acl_get_perm β€” test for a permission in an ACL permission set πŸ’–


πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library (libacl, link it with -lacl) β€” yeah bestie, you gotta bring the library to the party πŸŽ€


🌸 SYNOPSIS 🌸

#include <sys/types.h>
#include <acl/libacl.h>

int
acl_get_perm(acl_permset_t permset_d, acl_perm_t perm);

look at that signature. so clean. so iconic. ✨


πŸ’« DESCRIPTION πŸ’«

so the acl_get_perm() function does one (1) job and she does it well: she tests whether the permission you named in the argument perm is contained in the ACL permission set pointed to by the argument permset_d.

and what even is perm allowed to be, you ask? it's one of ACL_READ, ACL_WRITE, ACL_EXECUTE. those three. that's the whole menu. πŸ’…

and here's the cute part β€” any existing descriptors that refer to permset_d continue to refer to that permission set. nothing gets yanked out from under you. she's stable. she's loyal. 🫢


πŸŽ€ RETURN VALUE πŸŽ€

if it works out (and it will, bestie), acl_get_perm() returns:

  • 1 β€” yesss, the permission specified by perm is contained in the ACL permission set permset_d βœ…
  • 0 β€” nope, that permission is not contained in the permission set πŸ™ˆ

otherwise, the value -1 is returned and the global variable errno gets set to indicate the error. sad girl hours. 😭


πŸ’€ ERRORS πŸ’€

if any of the following conditions occur, acl_get_perm() returns -1 and sets errno to the corresponding value β€” read these, fr fr, don't skip:

  • [EINVAL] β€” the argument permset_d is not a valid descriptor for a permission set within an ACL entry. or the argument perm is not a valid acl_perm_t value. two ways to fail this vibe check, pick neither. ⚠️
ngl, EINVAL is just the universe saying "that's not a real thing, babe."

🌈 STANDARDS 🌈

this is a non-portable, Linux specific extension to the ACL manipulation functions defined in IEEE Std 1003.1e draft 17 ("POSIX.1e", abandoned). yes, abandoned. we don't talk about it. πŸ’€

so like, don't expect your BSD bestie's system to know what you're talking about. this is a Linux-only slay.

πŸ‘‘ SEE ALSO πŸ‘‘

go read her friends, they're all icons:


🧚 AUTHOR 🧚

written by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>. thank you for your service, king πŸ«‘πŸ’œ


and that's the whole page, bestie!! 🌸 this was the Linux ACL manual page for acl_get_perm(3), dated March 23, 2002, from the Linux ACL source. go forth and check those permissions, periodt. πŸ’…βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from