VOP_LISTEXTATTR(9)

πŸ’… VOP_LISTEXTATTR β€” the Kernel Developer's Manual girlies know her πŸ’…

okay so bestie, welcome to VOP_LISTEXTATTR(9), straight out of the Kernel Developer's Manual. this is the page where we learn how to ✨retrieve a list of named extended attribute from a vnode✨ (yes the original grammar says "attribute" singular, we're keeping it, no cap). sit down, hydrate, let's go 🫢


🌸 NAME 🌸

VOP_LISTEXTATTR β€” retrieve a list of named extended attribute from a vnode


✨ SYNOPSIS ✨

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

int
VOP_LISTEXTATTR(struct vnode *vp, int attrnamespace, struct uio *uio,
    size_t *size, struct ucred *cred, struct thread *td);

like look at that signature. iconic. no notes πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this vnode call is literally the one you use to retrieve a list of named extended attributes from a specified namespace on a file or directory. main character behavior fr fr.

its arguments are, in order, because we do not skip a single one:

  • vp β€” the vnode of the file or directory. your target. your girl.
  • attrnamespace β€” an integer constant indicating which extended attribute namespace the attribute name is present in.
  • uio β€” the location of the data to be read. the resulting data will be a list of attribute names. each list entry consists of a single byte containing the length of the attribute name, followed by the attribute name. and hear me on this: the attribute name is not terminated by ASCII NUL. no NUL. zero NULs. don't come for me.
  • size β€” if not NULL, on return it will contain the number of bytes required to read the list. and in most cases uio will be NULL when size is not, and vice versa. they're giving "you can't sit with us" energy, but like, functionally.
  • cred β€” the user credentials to use in authorizing the request.
  • td β€” the thread requesting the extended attribute.

and here's the tea about that cred pointer: it 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 retrieval that the active process might not be permitted to do. so like, the kernel gets a hall pass πŸ™ˆ

extended attribute semantics may vary by file system implementing the call. more information on extended attributes may be found in extattr(9). every fs is a different girl, respect it.


πŸ”’ LOCKS πŸ”’

the vnode will be locked on entry and should remain locked on return. do not let go. she's yours, hold her the whole time, periodt. πŸ‘‘


⭐ RETURN VALUES ⭐

on success, zero will be returned, and the uio structure will be updated to reflect the list read. slay. otherwise, an appropriate error code is returned, and you go cry about it (affectionately).


πŸ’€ ERRORS πŸ’€

  • [EACCES] β€” the caller does not have the appropriate privilege. not your moment bestie.
  • [ENXIO] β€” the request was not valid in this file system for the specified vnode and attribute name.
  • [ENOMEM] β€” sufficient memory is not available to fulfill the request. tragic.
  • [EFAULT] β€” the uio structure refers to an invalid userspace address. that address is not real, she's imaginary πŸ’€
  • [EINVAL] β€” the namespace or uio argument is invalid.
  • [EOPNOTSUPP] β€” the file system does not support VOP_LISTEXTATTR(). this fs said "not my genre" πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

extattr(9), vnode(9), VOP_GETEXTATTR(9), VOP_SETEXTATTR(9) β€” go read the whole friend group, they're all iconic.


and that's the page, babe πŸŽ€ this one shipped from Debian, dated August 19, 2005, and it still ate. mwah. go list some extended attributes, you got this. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from