VOP_SETACL(9)

✨ VOP_SETACL ✨

okay bestie, welcome to the VOP_SETACL page from the Kernel Developer's Manual, section 9 (that's the kernel-functions girly corner of the manpages πŸ’…). grab a strawberry matcha, we're setting access control lists on vnodes and it's gonna be adorable.


🌸 NAME 🌸

VOP_SETACL β€” set the access control list for a vnode


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <sys/vnode.h>
#include <sys/acl.h>

int
VOP_SETACL(struct vnode *vp, acl_type_t type, struct acl *aclp,
    struct ucred *cred, struct thread *td);

πŸ’– DESCRIPTION πŸ’–

so this vnode call is literally the one you use to set the access control list (ACL) for a file or directory. it's giving "i decide who gets in" energy πŸ‘‘

its arguments are, in order, and yes you have to care about all of them:

  • vp β€” the vnode of the file or directory. the main character, the thing you're editing.
  • type β€” the type of ACL to set. yes there are types, no you can't just vibe your way through it.
  • aclp β€” a pointer to an ACL structure from which to retrieve the ACL data.
  • cred β€” the user credentials to use in authorizing the request. the "who's asking" of it all.
  • td β€” the thread setting the ACL. hi thread 🫢

now here's the tea πŸ“: the aclp pointer may be NULL to indicate that the specified ACL should be deleted. poof, gone, no cap.

and the cred pointer may be NULL to indicate that access control checks are not to be performed, if possible. this cred setting might be used to allow the kernel to authorize ACL changes that the active process might not be permitted to make. that's a lot of power, bestie, use it responsibly 😭

ngl the vnode ACL interface defines the syntax, and not semantics, of file and directory ACL interfaces. so it tells you how to say it, not what it means. more info about ACL management in the kernel lives over in acl(9) if you wanna go read it (you should, it's iconic).

πŸ”’ LOCKS πŸ”’

the vnode will be locked on entry and should remain locked on return. that's the rule. don't unlock it, don't get cute, just keep it locked. periodt.


🌈 RETURN VALUES 🌈

if the ACL is successfully set, then zero is returned. slay, zero, success, we love her. ✨

otherwise, an appropriate error code is returned. an appropriate one. the kernel is being mature about it, you should be too.


πŸ’€ ERRORS πŸ’€

  • [EINVAL] β€” the ACL type passed is invalid for this vnode, or the ACL data is invalid. wrong type or wrong data, either way it's a no from her πŸ™ˆ
  • [EACCES] β€” the caller does not have the appropriate privilege. you simply are not that girl for this operation.
  • [ENOMEM] β€” sufficient memory is not available to fulfill the request. the vibes ran out of RAM.
  • [EOPNOTSUPP] β€” the file system does not support VOP_SETACL(). this filesystem said "not my thing."
  • [ENOSPC] β€” the file system is out of space. full. no room. tragic.
  • [EROFS] β€” the file system is read-only. babe it is read-only, you cannot write to it, i'm so sorry 😭

πŸ‘€ SEE ALSO πŸ‘€

go read the whole friend group, they're all connected, iykyk πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Robert Watson. thank you robert, absolute legend, ate and left no crumbs πŸ’…


and that's the page!! this one shipped with Debian, dated December 23, 1999 β€” yes, 1999, it's vintage and it's still serving. mwah, go set some ACLs responsibly bestie πŸ’–βœ¨

πŸ“¦ where this page comes from