EXTATTR(9)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1, nixpkgs unstable

✨ EXTATTR(9), bestie ✨

okay so this is the Kernel Developer's Manual page for extattr and it's literally all about virtual file system named extended attributes. no cap, it's giving very niche kernel knowledge but we're gonna get through it together πŸ’–


🌸 SYNOPSIS 🌸

like, first you gotta include these headers or it's not gonna work, periodt:

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

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so bestie, named extended attributes let you attach extra meta-data to vnodes that represent files and directories. The way it works is like a "name=value" pair situation β€” a name can be totally defined or undefined, and if it is defined, it's associated with zero or more bytes of arbitrary binary data. Iconic, honestly.

Here's the tea: extended attribute names exist within sets of namespaces, and every single operation on an extended attribute has to provide the namespace it's referring to. And if the same name shows up in multiple namespaces? Those extended attributes are stored and manipulated independently β€” they don't even know each other exist, we love healthy boundaries πŸ’…

The following two namespaces are defined universally (though individual file systems might implement additional namespaces, or just straight up not implement these ones, which is valid):

  • EXTATTR_NAMESPACE_USER
  • EXTATTR_NAMESPACE_SYSTEM

The semantics are intended to be like this:

  • user attribute data gets protected according to the normal discretionary and mandatory protections associated with the data in the file or directory
  • system attribute data is protected such that appropriate privilege is required to directly access or manipulate these attributes

By default, processes in a jail(8) cannot access the system attribute data unless the allow.extattr configuration parameter is specified. So like, keep that in mind or whatever πŸ™ˆ

Reads of extended attribute data may return specific contiguous regions of the meta-data, in the style of VOP_READ(9) β€” but writes? Writes will replace the entire current "value" associated with a given name. Not me just casually overwriting everything 😭

And because there are a plethora of file systems with differing extended attributes, the availability and functionality of these functions may be limited, and you really should use them with awareness of the underlying semantics of the supporting file system. Authorization schemes for extended attribute data may also vary by file system, plus the maximum attribute size, and whether or not any or specific new attributes may even be defined. It's giving "it depends" energy fr fr.

Extended attributes are named using a null-terminated character string. Depending on underlying file system semantics, this name may or may not be case-sensitive. The appropriate vnode extended attribute calls are: VOP_GETEXTATTR(9), VOP_LISTEXTATTR(9), and VOP_SETEXTATTR(9). Slay.


πŸŽ€ SEE ALSO πŸŽ€

go check these out bestie:


πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Robert Watson. We stan a kernel documentation icon πŸ’œ


πŸ’€ BUGS πŸ’€

Okay so here's the thing β€” the interface does not provide a mechanism to retrieve the current set of available attributes. It has been suggested that providing a NULL attribute name should cause a list of defined attributes for the passed file or directory, but this is not currently implemented. So like, don't try it, it won't work, that's the whole bug note 🫢


and that's the whole page bestie! this one's from the Debian crew, dated September 5, 2023, and it's the EXTATTR(9) page β€” go forth and attribute responsibly βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from