ACL_EQUIV_MODE(3)

πŸ’– ACL_EQUIV_MODE(3) πŸ’–

ok so bestie, this one lives in the Library Functions Manual, it's acl_equiv_mode from the Linux Access Control Lists library (libacl, link it with -lacl), and it's genuinely one of the cutest little functions in the whole ACL game. let's get into it πŸŽ€


✨ NAME ✨

acl_equiv_mode β€” check for an equivalent ACL


πŸ¦‹ LIBRARY πŸ¦‹

Linux Access Control Lists library (libacl, -lacl).


🌸 SYNOPSIS 🌸

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

int
acl_equiv_mode(acl_t acl, mode_t *mode_p);

πŸ’… DESCRIPTION πŸ’…

ok so here's the tea: acl_equiv_mode() looks at the ACL that acl points to and asks β€” is this thing just the bare minimum? like, does it contain only the required ACL entries, the ones with tag types ACL_USER_OBJ, ACL_GROUP_OBJ, and ACL_OTHER, and does it contain no permissions other than ACL_READ, ACL_WRITE, or ACL_EXECUTE? πŸ‘€

if the ACL is shaped like that, it can be fully represented with the traditional file permission bits, and it's considered equivalent with the traditional file permission bits. no cap. that's the whole vibe check. ⭐

and listen β€” if acl is an equivalent ACL and the pointer mode_p is not NULL, then the value pointed to by mode_p gets set to the value that defines the same owner, group and other permissions as contained in the ACL. so you get your classic mode bits handed back to you. iconic. 🫢


πŸ‘‘ RETURN VALUE πŸ‘‘

on success, this function returns the value 0 if acl is an equivalent ACL, and the value 1 if acl is not an equivalent ACL. on error, the value -1 is returned, and errno is set appropriately.

yes bestie, 1 is a success return here, not a failure β€” read it again, it's literally the answer to the question. πŸ’€

πŸ“ ERRORS πŸ“

if any of the following conditions occur, the acl_equiv_mode() function returns the value -1 and sets errno to the corresponding value:

  • [EINVAL] β€” The argument acl is not a valid pointer to an ACL.

🌈 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). so like… it's giving Linux-only, and yes the standard it extends is abandoned, we don't talk about that πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯


πŸ’œ AUTHOR πŸ’œ

Written by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>.


and that's the whole page bestie!! πŸ’– this one's from Linux ACL, dated March 23, 2002 β€” shoutout to the classics, mwah πŸ˜­πŸŽ€βœ¨

πŸ“¦ where this page comes from