ACL_ADD_PERM(3)

πŸ“¦
version 2.4.0 Β· 3 versions
, in arch rolling, centos-stream 10, centos-stream 9, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu stonking

πŸ’– ACL_ADD_PERM πŸ’–

okay so bestie, welcome to ACL_ADD_PERM(3) β€” yeah that's section 3 of the Library Functions Manual, we love a glow-up. this is the lil function that hands your permission set a brand new permission. she's small, she's mighty, she's giving ✨gatekeeper of the vibes✨. let's get into it 🫢


🌸 NAME 🌸

acl_add_perm β€” add a permission to an ACL permission set. that's it, that's the whole job, and she does it flawlessly πŸ’…


πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library (libacl, -lacl). yes queen, you gotta link her in πŸ”—


✨ SYNOPSIS ✨

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

int
acl_add_perm(acl_permset_t permset_d, acl_perm_t perm);

πŸ’« DESCRIPTION πŸ’«

so acl_add_perm() takes the permission sitting inside the argument perm β€” and bestie, perm is one of ACL_READ, ACL_WRITE, ACL_EXECUTE β€” and drops it into the permission set that the argument permset_d is pointing at. slay πŸ’–

and like, if you try to add a permission that's already in the permission set? not an error. not a problem. not a scandal. she just vibes. it's giving "oh you're already here? cool, stay." πŸ¦‹

also, important, no cap: any existing descriptors that refer to permset_d keep on referring to that same permission set. nobody gets swapped out, nobody gets ghosted. the way that continuity just works πŸ”₯


πŸ‘‘ RETURN VALUE πŸ‘‘

acl_add_perm() returns the value 0 if it succeeded. iconic. perfect. ate and left no crumbs.

otherwise the value -1 comes back, and the global variable errno gets set to tell you what went wrong. 😭 rude but informative.


🚨 ERRORS 🚨

if any of these conditions happen, acl_add_perm() returns -1 and sets errno to the corresponding value:

  • [EINVAL] β€” the argument permset_d is not a valid descriptor for a permission set within an ACL entry.

also [EINVAL] β€” the argument perm does not contain a valid acl_perm_t value.

fr fr, if you see EINVAL, something you passed in was Not It. check your descriptor, check your perm value, hydrate, try again πŸ’§

πŸ“ STANDARDS πŸ“

IEEE Std 1003.1e draft 17 (β€œPOSIX.1e”, abandoned)

and here's the tea β˜•: in the Linux implementation, perm is a bitwise set of permissions that acl_add_perm() will all add at once. very efficient, very main character. but this use is not portable. so if you're taking your code anywhere else, heads up bestie, that trick doesn't travel βœˆοΈπŸ’€


πŸ”— SEE ALSO πŸ”—


πŸŽ€ AUTHOR πŸŽ€

Derived from the FreeBSD manual pages written by Robert N M Watson <rwatson@FreeBSD.org>, and adapted for Linux by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>.

shoutout to the legends who wrote the lore πŸ«‘πŸ’œ


and that's the whole page, bestie!! Linux ACL, March 23, 2002 β€” ACL_ADD_PERM(3), forever in our hearts. go add some permissions, you absolute icon 🌈⭐

πŸ“¦ where this page comes from