extattr_get_fd, extattr_set_fd, extattr_delete_fd,
extattr_set_file, extattr_delete_file - system calls to manipulate VFS
extattr_get_fd(int fd, int attrnamespace, const char
void *data, size_t nbytes);
extattr_set_fd(int fd, int attrnamespace, const char
const void *data, size_t nbytes);
extattr_delete_fd(int fd, int attrnamespace, const char
extattr_get_file(const char *path, int attrnamespace,
const char *attrname, void *data, size_t nbytes);
extattr_set_file(const char *path, int attrnamespace,
const char *attrname, const void *data, size_t
extattr_delete_file(const char *path, int attrnamespace,
const char *attrname);
Named extended attributes are meta-data associated with vnodes representing
files and directories. They exist as "name=value" pairs
within a set
of namespaces. The extattr_get_file() call retrieves the
value of the
specified extended attribute into a buffer pointed to by
data of size
nbytes. The extattr_set_file() call sets the value of the
attribute to the data described by data. The
extattr_delete_file() call deletes the extended attribute
extattr_get_file() and extattr_set_file() calls consume the
nbytes arguments in the style of read(2) and write(2), respectively. If
data is NULL in a call to extattr_get_file() then the size
of defined extended
attribute data will be returned, rather than the
permitting applications to test the size of the data without
The extatttr_get_fd(), extattr_set_fd(), and
are identical to their "_file" counterparts except for the
The "_fd" functions take a file descriptor, while the
functions take a path. Both arguments describe a file associated with
the extended attribute that should be manipulated.
The following arguments are common to all the system calls
attrnamespace the namespace in which the extended attribute
attrname the name of the extended attribute
Named extended attribute semantics vary by filesystem implementing the
call. Not all operations may be supported for a particular
Additionally, the format of the data in data is attributespecific.
For more information on named extended attributes, please
If successful, the extattr_get_file() and extattr_set_file()
the number of bytes that were read or written from the data,
or if data was NULL, then extattr_get_file() returns the
bytes available to read. If any of the calls are unsuccessful, the value
-1 is returned and the global variable errno is set to indicate the error.
The extattr_delete_file() function returns the value 0 if
otherwise the value -1 is returned and the global variable
errno is set
to indicate the error.
The following errors may be returned by the system calls
the filesystem implementing the call may return
any other errors
[EFAULT] attrnamespace, attrname, or the memory range
data and nbytes points outside the process's
The attribute name was longer than EXTATTR_MAXNAMELEN.
The extattr_get_fd(), extattr_set_fd(), and
may also fail if:
[EBADF] The file descriptor referenced by fd was invalid.
Additionally, the extattr_get_file(), extattr_set_file(),
extattr_delete_file() calls may also fail due to the following errors:
[ENOTDIR] A component of the path prefix is not a directory.
A component of a pathname exceeded 255 characters, or an
entire path name exceeded 1023 characters.
[ENOENT] A component of the path name that must exist
does not exist.
[EACCES] Search permission is denied for a component of
[ENOATTR] An attribute does not exist for the specified
extattr(3), extattrctl(8), getextattr(8), setextattr(8), extattr(9)
Extended attribute support was developed as part of the
and introduced in OpenBSD 3.1. It was developed to
extensions requiring additional labels to be associated
with each file
This interface is under active development, and as such is
change as applications are adapted to use it. Developers
from relying on its stability.
OpenBSD 3.6 March 28, 2001
[ Back ]