VOP_ACCESS(9)

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

🌸 NAME 🌸

okay so welcome to the VOP_ACCESS(9) manual page from the Kernel Developer’s Manual, bestie πŸ’– β€” this one covers VOP_ACCESS, VOP_ACCESSX, and their whole thing: checking access permissions of a file or a Unix domain socket. periodt.


✨ SYNOPSIS ✨

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

int
VOP_ACCESS(struct vnode *vp, accmode_t accmode, struct ucred *cred,
    struct thread *td);

int
VOP_ACCESSX(struct vnode *vp, accmode_t accmode, struct ucred *cred,
    struct thread *td);

πŸ¦‹ DESCRIPTION πŸ¦‹

This entry point is literally the permission-check main character: it checks the access permissions of the file against the given credentials. no cap.

Its arguments are giving:

  • vp β€” the vnode of the file to check. the file’s little kernel-side representative πŸ’…
  • accmode β€” the type of access required.
  • cred β€” the user credentials to check.
  • td β€” the thread which is checking.

The accmode is a mask which can contain flags described in <sys/vnode.h>, e.g. VREAD, VWRITE or VEXEC. For VOP_ACCESS(), the only flags that may be set in accmode are VEXEC, VWRITE, VREAD, VADMIN and VAPPEND. To check for other flags, one has to use VOP_ACCESSX() instead. iykyk πŸ”₯


πŸ”’ LOCKS πŸ”’

The vnode will be locked on entry and should remain locked on return. so like… it comes in locked and leaves locked, bestie β€” don’t be weird about it 🫢


πŸŽ€ RETURN VALUES πŸŽ€

If the file is accessible in the specified way, then zero is returned, otherwise an appropriate error code is returned. slay when it’s zero, sad little error code when it’s not 😭


πŸ’€ ERRORS πŸ’€

  • [EPERM] β€” An attempt was made to change an immutable file.
  • [EACCES] β€” The permission bits the file mode or the ACL do not permit the requested access.

πŸ‘‘ SEE ALSO πŸ‘‘


🫢 AUTHORS 🫢

This manual page was written by Doug Rabson. iconic behavior, honestly 🌈


This page came from Debian, dated September 18, 2009, and its manual-page tag is VOP_ACCESS(9) πŸ’–βœ¨

πŸ“¦ where this page comes from