VOP_ACCESS(9)
π VOP_ACCESS β check access permissions of a file or Unix domain socket π
okay bestie, welcome to the Kernel Developer's Manual, page VOP_ACCESS(9). yes we're in the kernel now, yes it's giving main character energy, and yes you're gonna understand it. let's go β¨
π NAME π
VOP_ACCESS, VOP_ACCESSX β check access permissions of a file or Unix domain socket
πΈ 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 π¦
so this entry point checks the access permissions of the file against the credentials you hand it. that's the whole vibe. it's a permission vibe check, for files.
its arguments are, bestie, listen up:
vpβ the vnode of the file we're checking. the file in question, the it-girl, the subject πaccmodeβ the type of access required. like, what are we even trying to do here?credβ the user credentials to check. who's asking? πtdβ the thread which is checking. the one doing the asking, fr fr.
so accmode is a mask that can contain flags described in <sys/vnode.h>, e.g. VREAD, VWRITE or VEXEC.
now here's the tea π: for VOP_ACCESS(), the only flags that may be set in accmode are VEXEC, VWRITE, VREAD, VADMIN and VAPPEND. that's it, that's the list, no cap. if you wanna check for other flags, you have to use VOP_ACCESSX() instead. different function, different energy, periodt.
π LOCKS π
the vnode will be locked on entry and should remain locked on return. it goes in locked, it comes out locked. we don't unlock things we didn't lock, bestie, that's not the move π
β RETURN VALUES β
- if the file is accessible in the specified way β zero is returned. slay, we ate π
- otherwise β an appropriate error code is returned. it's giving rejection π
π ERRORS π
[EPERM]β an attempt was made to change an immutable file. it's immutable, girl, you literally cannot. respect the boundaries.[EACCES]β the permission bits of the file mode or the ACL do not permit the requested access. the permission bits said no, and the ACL also said no. it's a no from both of them β
π SEE ALSO π
vaccess(9), vaccess_acl_nfs4(9), vaccess_acl_posix1e(9), vnode(9)
go read those too, iykyk, expanding your kernel knowledge is highkey the move π
π AUTHORS π
this manual page was written by Doug Rabson. we love Doug. iconic behavior, thank you for your service π«Ά
and that's the whole page, bestie!! this beauty is from the Debian manual set, dated September 18, 2009 β yeah it's an elder but it's still THAT girl, and it's still VOP_ACCESS(9). stay safe out there, check your permissions, and never let a vnode out of a lock you put it in π
β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms