VOP_SETEXTATTR(9)
π VOP_SETEXTATTR(9) β the vnode extended-attribute-setter manual page, bestie edition
okay so you're in the Kernel Developer's Manual section 9, and we're talking about VOP_SETEXTATTR β setting a named extended attribute for a vnode. yes, the kernel's little sticky-notes-on-files situation. let's get into it π«Ά
β¨ 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);
π¦ DESCRIPTION π¦
This vnode call is literally how you set a specific named extended attribute on a file or directory. main character energy for metadata, no cap.
Its arguments are, in order, because the order matters bestie:
vpβ the vnode of the file or directory. the whole point, honestly.attrnamespaceβ an integer constant indicating which extended attribute namespace the attribute name lives in. which little club is this attribute in πnameβ pointer to a null-terminated character string containing the attribute name.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. hi thread π
The uio structure is used in a manner similar to the argument of the same name in VOP_WRITE(9). However β and this is the important part β since extended attributes provide a strict "name=value" semantic, non-zero offsets will be rejected. so don't come in here with your little offsets, okay? it's giving invalid.
The uio pointer may be NULL to indicate that the specified extended attribute should be deleted. yes, deletion, through the set function. that's just how it is π
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 extended attribute changes that the active process might not be permitted to make. (the kernel gets to skip the line sometimes, periodt.)
β οΈ Extended attribute semantics may vary by file system implementing the call. so your fave filesystem and your other fave filesystem might not agree on the details, and that's a real thing to keep in mind.
More information on extended attributes may be found in extattr(9). go read it, iykyk π
π LOCKS π
The vnode will be locked on entry and should remain locked on return. do not let go of the vnode. hold it. π₯Ί
β RETURN VALUES β
If the extended attribute is successfully set, then zero is returned. otherwise, an appropriate error code is returned. zero = slay, anything else = vibe check failed.
π ERRORS π
[EACCES]β The caller does not have the appropriate privilege.[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().[ENOSPC]β The file system is out of space.[EROFS]β The file system is read-only.
π SEE ALSO π
extattr(9), vnode(9), VOP_GETEXTATTR(9), VOP_LISTEXTATTR(9)
the whole extended-attribute friend group, fr fr π
π AUTHORS π
This manual page was written by Robert Watson. thank you Robert, icon behavior π
and that's the whole page bestie, every flag, every error, every pointer β nothing dropped, we ate and left no crumbs π
this edition came from Debian, dated December 23, 1999 β yeah, it's vintage vintage, but the lore still hits β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms