ACL_SET(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

✨ 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 ACL
  • ACL_TYPE_DEFAULT β€” POSIX.1e default ACL
  • ACL_TYPE_NFS4 β€” NFSv4 ACL
⚠️ trying to set ACL_TYPE_NFS4 with acl branded as POSIX.1e, or ACL_TYPE_ACCESS or ACL_TYPE_DEFAULT with 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] β€” The fd argument 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] β€” Argument acl does not point to a valid ACL for this object, or the ACL type specified in type is 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 exceeded 255 characters, or an entire path name exceeded 1023 characters. that's a long name, bestie, she's overextended 🫠
  • [ENOENT] β€” The named object does not exist, or the path_p argument 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