ACL_SET(3)
β¨ ACL_SET π
okay so bestie, this page is from the Standard C Library (libc, -lc) and it's literally about setting ACLs on files. it's giving "access control but make it fashion" and i'm obsessed. let's get into it π«Ά
πΈ NAME πΈ
acl_set_fd, acl_set_fd_np, acl_set_file, acl_set_link_np β set an ACL for a file. no cap, that's the whole vibe.
π LIBRARY π
Standard C Library (libc, -lc) β she's iconic, she's everywhere, she's libc π
π¦ SYNOPSIS π¦
#include <sys/types.h>
#include <sys/acl.h>
int
acl_set_fd(int fd, acl_t acl);
int
acl_set_fd_np(int fd, acl_t acl, acl_type_t type);
int
acl_set_file(const char *path_p, acl_type_t type, acl_t acl);
int
acl_set_link_np(const char *path_p, acl_type_t type, acl_t acl);
π DESCRIPTION π
so like, acl_set_fd(), acl_set_fd_np(), acl_set_file(), and acl_set_link_np() each associate an ACL with an object referred to by fd or path_p. think of it as matching the right accessory to the right outfit, fr fr β¨
now, important tea β: acl_set_fd_np() and acl_set_link_np() are not POSIX.1e calls. they're the cool non-standard cousins, iykyk.
the acl_set_fd() function allows only the setting of ACLs of type ACL_TYPE_ACCESS β she's picky, she has one type and she's sticking to it. whereas acl_set_fd_np() allows the setting of ACLs of any type. main character energy, she does it all π
the acl_set_link_np() function acts on a symlink rather than its target, if the target of the path is a symlink. like, she sees the link itself, not where it points. no cap, that's the whole point.
Valid values for the type argument are (bestie, memorize these, they're literally the menu):
ACL_TYPE_ACCESSβ POSIX.1e access ACLACL_TYPE_DEFAULTβ POSIX.1e default ACLACL_TYPE_NFS4β NFSv4 ACL
β οΈ trying to setACL_TYPE_NFS4with acl branded as POSIX.1e, orACL_TYPE_ACCESSorACL_TYPE_DEFAULTwith ACL branded as NFSv4, will result in error. it's giving mismatch, it's giving "these are not the same girlies", and it will not slay. periodt. π
π§ IMPLEMENTATION NOTES π§
FreeBSD's support for POSIX.1e interfaces and features is still under development at this time. so like, she's a work in progress bestie, we love a glow-up in motion π±β¨
π RETURN VALUES π
Upon successful completion, the value 0 is returned β that's the "we ate and left no crumbs" moment π. otherwise, the value -1 is returned and the global variable errno is set to indicate the error. not the vibe, but at least she tells you what went wrong π
π₯ ERRORS π₯
if any of the following conditions occur, these functions shall return -1 and set errno to the corresponding value. let's go through the whole list, no skipping, bestie:
[EACCES]β Search permission is denied for a component of the path prefix, or the object exists and the process does not have appropriate access rights.[EBADF]β Thefdargument is not a valid file descriptor. like, that's not a real file descriptor, it's a nothing, it's not invited to the function π[EINVAL]β Argumentacldoes not point to a valid ACL for this object, or the ACL type specified intypeis invalid for this object, or there is branding mismatch. it's giving invalid, it's giving "wrong era, wrong aesthetic" π[ENAMETOOLONG]β A component of a pathname exceeded255characters, or an entire path name exceeded1023characters. that's a long name, bestie, she's overextended π«[ENOENT]β The named object does not exist, or thepath_pargument points to an empty string. it's giving ghosted, it's giving nothing was there π»[ENOMEM]β Insufficient memory available to fulfill request. she ran out of room, it's not her fault, it's a memory issue, fr fr.[ENOSPC]β The directory or file system that would contain the new ACL cannot be extended, or the file system is out of file allocation resources. no more space, that's the tea π«[EOPNOTSUPP]β The file system does not support ACL retrieval. she's just not built for that, she's a different genre π€·ββοΈ[EROFS]β This function requires modification of a file system which is currently read-only. like, you can't write on a read-only file system, that's literally the rule, bestie π
π¦ SEE ALSO π¦
okay so these are the sister pages, the whole friend group, click through for the lore:
π STANDARDS π
POSIX.1e is described in IEEE POSIX.1e draft 17. and like, discussion of the draft continues on the cross-platform POSIX.1e implementation mailing list β it's giving community, it's giving "join the group chat π¬". to join this list, see the FreeBSD POSIX.1e implementation page for more information. iykyk, the link is in the bio.
π HISTORY π
POSIX.1e support was introduced in FreeBSD 4.0, and development continues. she's been around, she's got history, and she's still evolving π±β¨
π AUTHORS π
Robert N M Watson β thank you for your service, bestie π«‘π
so yeah, that's the whole page, every detail preserved, every error and flag accounted for, and honestly? she ate. this is the Debian version, dated June 25, 2009 β vintage but still iconic. byeee, go set some ACLs and slay responsibly π β¨π¦
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2000, 2002 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms