ACL_CREATE_ENTRY(3)

πŸ“¦
version 2.4.0 Β· 2 versions
  • 2.4.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 14.5, freebsd 15.1
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

acl_create_entry β€” bestie, we're making a brand new ACL entry πŸ’–

πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library, aka libacl, link it with -lacl and you're good 🫢


🌸 SYNOPSIS 🌸

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

int
acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p);

πŸ’… DESCRIPTION πŸ’…

okay so. acl_create_entry() makes a whole new ACL entry inside the ACL that the pointer argument acl_p points to. and like, when it works? it hands you back a descriptor for that shiny new entry through entry_p. iconic behavior tbh ✨

⚠️ heads up: this function may cause memory to be allocated. that's the vibe, that's the cost.

so the caller should free any releasable memory once the new ACL isn't needed anymore β€” do that by calling acl_free(3) with (void*)*acl_p as the argument. no leaks, we don't do that here πŸ’€

and here's the lowkey important part: if the ACL working storage cannot be increased in its current location, then the working storage for the ACL pointed to by acl_p may get relocated, and the previous working storage is released. a pointer to the new working storage comes back to you via acl_p. so yeah, don't go clutching that old pointer, it's giving ex-energy πŸ™ˆ

πŸŽ€ how the new entry starts out πŸŽ€

the components of the new ACL entry get initialized like this:

  • the ACL tag type component contains ACL_UNDEFINED_TAG
  • the qualifier component contains ACL_UNDEFINED_ID
  • the set of permissions has no permissions enabled

and any existing ACL entry descriptors that refer to entries in the ACL? they continue to refer to those entries. no chaos, no shuffling, everyone keeps their seat πŸͺ‘


⭐ RETURN VALUE ⭐

  • it returns the value 0 if it's successful πŸ’–
  • otherwise the value -1 is returned, and the global variable errno is set to indicate the error 😭

πŸ”₯ ERRORS πŸ”₯

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

  • [EINVAL] β€” the argument acl_p is not a valid pointer to an ACL. like bestie, that's not an ACL, that's a vibe check you failed πŸ’€
  • [ENOMEM] β€” the ACL working storage requires more memory than is allowed by the hardware or system-imposed memory management constraints. the machine said "no more" and honestly? same 🫠

πŸ‘‘ STANDARDS πŸ‘‘

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

yeah, abandoned. not our fault, we just work here 😭 but she still slays.


🌈 SEE ALSO 🌈

(yes, acl_create_entry(3) is listed in its own SEE ALSO. self-love, we respect it πŸ’…)


πŸ¦‹ 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>. thank you legends 🫢✨


Linux ACL Β· March 23, 2002 Β· ACL_CREATE_ENTRY(3)

okay that's the whole page bestie, go create some entries, hydrate, and remember: acl_free(3) is not optional πŸ’–πŸŒΈβœ¨πŸŽ€

πŸ“¦ where this page comes from