VOP_ATTRIB(9)
π VOP_ATTRIB β it's giving "get and set attributes" energy β¨
okay bestie so this is from the Kernel Developer's Manual, section 9, and the page is called VOP_ATTRIB(9) π buckle up because we're talking about VOP_GETATTR and VOP_SETATTR, the duo that gets and sets attributes on a file or directory. no cap. π¦
β¨ NAME β¨
VOP_GETATTR, VOP_SETATTR β get and set attributes on a file or directory π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
int
VOP_GETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred);
int
VOP_SETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred);
like. look at those signatures. iconic. π«Ά
π DESCRIPTION π
These entry points manipulate various attributes of a file or directory, and the list is lowkey long: file permissions, owner, group, size, access time and modification time. all of it. the whole glow-up kit. β¨
The arguments are:
vpβ The vnode of the file. πvapβ The attributes of the file.credβ The user credentials of the calling process.
okay this part matters so listen up fr fr π
Attributes which are not being modified by VOP_SETATTR() should be set to the value VNOVAL. VATTR_NULL() may be used to clear all the values, and should generally be used to reset the contents of *vap prior to setting specific values.
so yes: VNOVAL for the stuff you're not touching, VATTR_NULL() to wipe *vap clean before you set the specific values you actually care about. reset first, then slay. π§Όβ‘οΈπ
π LOCKS π
VOP_GETATTR() expects the vnode to be locked on entry and will leave the vnode locked on return. The lock type can be either shared or exclusive. so flexible. we love options. π
VOP_SETATTR() expects the vnode to be locked on entry and will leave the vnode locked on return. The lock type must be exclusive. no shared vibes allowed here bestie, it's exclusive-only main character energy. π
π RETURN VALUES π
VOP_GETATTR() returns 0 if it was able to retrieve the attribute data via *vap, otherwise an appropriate error is returned.
VOP_SETATTR() returns zero if the attributes were changed successfully, otherwise an appropriate error is returned. periodt. π
π ERRORS π
[EPERM]β The file is immutable. like it said no and meant it. π«[EACCES]β The caller does not have permission to modify the file or directory attributes. bestie you do not have the range. π[EROFS]β The file system is read-only. nothing to see here, it's frozen. π§
π SEE ALSO π
VFS(9), vnode(9), VOP_ACCESS(9) β go read those next, iykyk πβ¨
π«Ά AUTHORS π«Ά
This manual page was written by Doug Rabson. ty king for your service ππ
and that's the whole page bestie!! π this version lives over on Debian, dated August 29, 2008, so likeβ¦ vintage but still eating. πβ¨π¦
π¦ 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