ACL_FROM_MODE(3)

πŸ’– ACL_FROM_MODE(3) πŸ’–

okay bestie, so this one is acl_from_mode from the Library Functions Manual β€” it lives in section 3, it's the lil glow-up function that turns boring old file permission bits into a whole entire ACL. no cap.


✨ NAME ✨

acl_from_mode β€” create an ACL from file permission bits πŸŽ€

πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library (that's libacl, and you link it with -lacl) πŸ¦‹

🌸 SYNOPSIS 🌸

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

acl_t
acl_from_mode(mode_t mode);

πŸ’… DESCRIPTION πŸ’…

So the acl_from_mode() function creates a minimal ACL, and when I say minimal I mean it is giving bare minimum, it has literally just three entries:

  • one with tag type ACL_USER_OBJ
  • one with tag type ACL_GROUP_OBJ
  • one with tag type ACL_OTHER

and the permissions on those entries correspond to the owner, group, and other permission bits of its argument mode. that's it. that's the whole function. iconic behaviour honestly 🌈

⭐ RETURN VALUE ⭐

On success, this function returns a pointer to the working storage. 🫢

On error, a value of (acl_t)NULL is returned, and errno is set appropriately. sad girl hours 😭

πŸ’€ ERRORS πŸ’€

If any of the following conditions occur, the acl_from_mode() function returns a value of (acl_t)NULL and sets errno to the corresponding value:

  • [ENOMEM] β€” the ACL working storage requires more memory than is allowed by the hardware or system-imposed memory management constraints. (she's asking for too much and the system said no πŸ™ˆ)

πŸ‘‘ 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 bestie, abandoned. we don't talk about it. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

πŸŽ€ AUTHOR πŸŽ€

Written by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>. thank you king πŸ‘‘


and that's the whole page, bestie β€” from Linux ACL, dated March 23, 2002, and it's the ACL_FROM_MODE(3) page. go forth and make minimal ACLs, ily, mwah πŸ’–πŸ§šπŸŒΈ

πŸ“¦ where this page comes from