VOP_SETEXTATTR(9)
π VOP_SETEXTATTR β the kernel-dev manual page, bestie edition β¨
okay so you're in the 9 section of the kernel developer's manual, and today's main character is VOP_SETEXTATTR β the vnode call that sets a named extended attribute on a file or directory. yes, that one. let's go π¦
β¨ NAME β¨
VOP_SETEXTATTR β set named extended attribute for a vnode
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
#include <sys/extattr.h>
int
VOP_SETEXTATTR(struct vnode *vp, int attrnamespace, const char *name,
struct uio *uio, struct ucred *cred, struct thread *td);
like. look at that signature. she's giving "i know exactly what i'm doing" energy and honestly? she does π
π DESCRIPTION π
So this vnode call is the one you use to set a specific named extended attribute for a file or directory. that's the whole vibe. no notes.
now let's meet the arguments, one by one, because they all matter and i refuse to gloss over any of them π«Ά
vpβ the vnode of the file or directory. the actual thing you're decorating with attributes β¨attrnamespaceβ an integer constant indicating which extended attribute namespace the attribute name lives in. so like, which section of the attribute universe we're in πͺnameβ a pointer to a null-terminated character string containing the attribute name. yes bestie, null-terminated, don't forget πuioβ the location of the data to be read or written.credβ the user credentials to use in authorizing the request.tdβ the thread setting the extended attribute.
okay now the juicy part. the uio structure gets used in a manner similar to the argument of the same name in VOP_WRITE(9). BUT β and this is the plot twist β because extended attributes give you a strict "name=value" semantic, non-zero offsets will be rejected. no partial writes, no sneaky offsets. the vibe check does not pass. periodt.
the uio pointer may be NULL, which is the way you say "actually, delete this extended attribute please" π. iconic behaviour honestly.
the cred pointer may be NULL to indicate that access control checks are not to be performed, if possible. and lowkey this setting might be used to allow the kernel to authorize extended attribute changes that the active process might not be permitted to make. so, you know. powerful. use with intention π
also important: extended attribute semantics may vary by file system implementing the call. every fs does her own thing, we respect it π. more information on extended attributes may be found in extattr(9).
π LOCKS π
The vnode will be locked on entry and should remain locked on return.
that's it. that's the whole section. she's locked in, she stays locked in, we don't play games π
β RETURN VALUES β
If the extended attribute is successfully set, then zero is returned. slay. π
Otherwise, an appropriate error code is returned. not slay. π
π ERRORS π
here's the full roster, no skipping, i promised:
[EACCES]β The caller does not have the appropriate privilege. like, who do you think you are bestie π«[ENXIO]β The request was not valid in this file system for the specified vnode and attribute name.[ENOMEM]β Insufficient memory available to fulfill the request.[EFAULT]β Theuiostructure refers to an invalid userspace address.[EINVAL]β Thename, namespace, oruioargument is invalid.[EOPNOTSUPP]β The file system does not supportVOP_SETEXTATTR(). she simply does not do that β[ENOSPC]β The file system is out of space.[EROFS]β The file system is read-only. no writing. none. zero. the audacity of trying π§
π¦ SEE ALSO π¦
the whole extended-attribute friend group honestly. go read them all, iykyk π
π AUTHORS π
This manual page was written by Robert Watson.
absolute legend, we thank her for her service π«‘
and that's the page!! this one came from the Debian crew, dated December 23, 1999, and it's VOP_SETEXTATTR(9) all the way through π mwah, go set some attributes responsibly, bestie πΈ
π¦ 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) 1999, 2000, 2001 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms