ACL_FROM_TEXT(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_FROM_TEXT πŸ’– (that's a section 3 library call bestie, we're in the libacl cinematic universe)

okay so first things first, hi, welcome to the group chat 🫢 today we are talking about acl_from_text, a function from the Linux Access Control Lists library, aka libacl, and you link it with -lacl. she's little, she's powerful, she turns your sad little text into a whole internal ACL. periodt.


✨ NAME ✨

acl_from_text β€” create an ACL from text πŸŽ€


πŸ“š LIBRARY πŸ“š

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

like. that's the whole section. she's brief. she's iconic. πŸ’…


🌸 SYNOPSIS 🌸

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

acl_t
acl_from_text(const char *buf_p);

look at her. three lines and a dream. 🌈


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the way acl_from_text() works is: you hand her a pointer to the text form of an ACL, that's buf_p, and she converts it into the internal form of an ACL, and then she returns a pointer to the working storage that's holding that ACL. she ate, honestly. πŸ”₯

and ngl she's flexible about what you feed her β€” acl_from_text() accepts the long text form and the short text form of an ACL, both of which are described in acl(5). iykyk.

πŸ’€ real talk though: this function may cause memory to be allocated. so when you don't need the new ACL anymore, the caller should free any releasable memory by calling acl_free(3), passing the (void*)acl_t that acl_from_text() returned as the argument. do NOT ghost your malloc. she will remember.

🌟 RETURN VALUE 🌟

  • on success, she returns a pointer to the working storage ✨
  • on error, you get a value of (acl_t)NULL, and errno is set appropriately 😭

🚨 ERRORS 🚨

if any of these little situations pop up, acl_from_text() returns (acl_t)NULL and sets errno to the matching value:

  • [EINVAL] β€” the argument buf_p cannot be translated into an ACL. she looked at your text and said "ma'am this is not an ACL" πŸ™ˆ
  • [ENOMEM] β€” the acl_t to be returned requires more memory than is allowed by the hardware or system-imposed memory management constraints. the machine said no πŸ’€

πŸ‘‘ STANDARDS πŸ‘‘

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

not me crying over an abandoned standard 😭 she was too good for this world fr fr

πŸ” SEE ALSO πŸ”

go read them, bestie, they're all in the same friend group 🫢


πŸ’œ 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>.


and that's the whole vibe check 🌈 this page came from the Linux ACL manual, dated March 23, 2002 β€” shoutout to the ancestors who wrote this so you could read it in a terminal with butterflies and emoji. slay, hydrate, and always acl_free(3) your ACLs. bye bestie πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from