ACL_GET_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

✨ ACL_GET_ENTRY(3) ✨

okay so bestie, welcome to the acl_get_entry page from the Linux Library Functions Manual πŸ’… this one's all about walking through an ACL entry by entry, like you're scrolling a group chat and reading every single message in order. no skipping. we don't skip. 🫢


πŸŽ€ NAME πŸŽ€

acl_get_entry β€” get an ACL entry


πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library (libacl, -lacl). yep, that's the one you link against πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

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

int
acl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p);

πŸ’– DESCRIPTION πŸ’–

so the acl_get_entry() function hands you a descriptor for an ACL entry, and which entry you get depends on entry_id, inside the ACL that the acl argument points at. 🌸

  • if entry_id is ACL_FIRST_ENTRY, the function drops into entry_p a descriptor for the first ACL entry inside acl. starting from the top, main character energy πŸ‘‘
  • if entry_id is ACL_NEXT_ENTRY, the function drops into entry_p a descriptor for the next ACL entry inside acl. keep it moving, bestie ➑️

now here's the part where you gotta pay attention, no cap 🚨 β€” if you call acl_get_entry() with entry_id set to ACL_NEXT_ENTRY when there has not been either:

  • an initial successful call to acl_get_entry(), or
  • a previous successful call to acl_get_entry() following a call to acl_calc_mask(), acl_copy_int(), acl_create_entry(), acl_delete_entry(), acl_dup(), acl_from_text(), acl_get_fd(), acl_get_file(), acl_set_fd(), acl_set_file(), or acl_valid()

then the effect is unspecified. like, genuinely unspecified. we do not know what happens. that's not a vibe, that's a warning 🫠

calls to acl_get_entry() do not modify any ACL entries. zero changes, we're just looking πŸ‘€ subsequent operations that use the returned ACL entry descriptor operate on the ACL entry within the ACL in working storage. the order of all existing entries in the ACL stays exactly the same β€” untouched, unbothered. ✨ any existing ACL entry descriptors that refer to entries within the ACL keep on referring to those entries. any existing ACL pointers that refer to the ACL referred to by acl keep on referring to the ACL. everything stays put, periodt πŸ’…


πŸ”₯ RETURN VALUE πŸ”₯

  • if the function successfully gets an ACL entry, it returns a value of 1. slay πŸŽ‰
  • if the ACL has no ACL entries, it returns the value 0. empty. nada. the void πŸ•³οΈ
  • if entry_id is ACL_NEXT_ENTRY and the last ACL entry in the ACL has already been returned by a previous call to acl_get_entry(), the function returns the value 0 until a successful call with an entry_id of ACL_FIRST_ENTRY is made. you hit the end of the scroll and it just sits there at 0 until you go back to the top πŸ”
  • otherwise, the value -1 is returned and errno is set to indicate the error. it's giving error energy 😭

πŸ’€ ERRORS πŸ’€

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

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

also, the argument entry_id is neither ACL_NEXT_ENTRY nor ACL_FIRST_ENTRY. wrong flag, bestie, pick one of the two πŸ™ˆ


🌈 STANDARDS 🌈

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

(yes it says abandoned. we still love her. iconic even in retirement πŸ’œ)


πŸ‘€ SEE ALSO πŸ‘€

acl_calc_mask(3), acl_create_entry(3), acl_copy_entry(3), acl_delete_entry(3), acl_get_file(3), acl(5)

go read those too, they're all connected, iykyk πŸ”—


🧚 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>. legends, honestly 🫢


and that's the whole page bestie!! 🌸 this one came from the Linux ACL crew and it's dated March 23, 2002 β€” old but gold, still hitting different. go forth and iterate those ACL entries responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from