1 .\" Copyright (C) Andreas Gruenbacher, February 2001
2 .\" Copyright (C) Silicon Graphics Inc, September 2001
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .TH setxattr 2 (date) "Linux man-pages (unreleased)"
8 setxattr, lsetxattr, fsetxattr \- set an extended attribute value
11 .RI ( libc ", " \-lc )
14 .B #include <sys/xattr.h>
16 .BI "int setxattr(const char *" path ", const char *" name ,
17 .BI " const void " value [. size "], size_t " size ", int " flags );
18 .BI "int lsetxattr(const char *" path ", const char *" name ,
19 .BI " const void " value [. size "], size_t " size ", int " flags );
20 .BI "int fsetxattr(int " fd ", const char *" name ,
21 .BI " const void " value [. size "], size_t " size ", int " flags );
24 Extended attributes are
26 pairs associated with inodes (files, directories, symbolic links, etc.).
27 They are extensions to the normal attributes which are associated
28 with all inodes in the system (i.e., the
31 A complete overview of extended attributes concepts can be found in
37 of the extended attribute identified by
39 and associated with the given
44 argument specifies the size (in bytes) of
46 a zero-length value is permitted.
51 except in the case of a symbolic link, where the extended attribute is
52 set on the link itself, not the file that it refers to.
57 only the extended attribute is set on the open file referred to by
64 An extended attribute name is a null-terminated string.
67 includes a namespace prefix; there may be several, disjoint
68 namespaces associated with an individual inode.
71 of an extended attribute is a chunk of arbitrary textual or
72 binary data of specified length.
78 the extended attribute will be created if it does not exist,
79 or the value will be replaced if the attribute already exists.
80 To modify these semantics, one of the following values can be specified in
84 Perform a pure create, which fails if the named attribute exists already.
87 Perform a pure replace operation,
88 which fails if the named attribute does not already exist.
90 On success, zero is returned.
91 On failure, \-1 is returned and
93 is set to indicate the error.
97 Disk quota limits meant that
98 there is insufficient space remaining to store the extended attribute.
102 was specified, and the attribute exists already.
106 was specified, and the attribute does not exist.
108 .\" is defined to be a synonym for
111 .\" .IR <attr/attributes.h> .)
114 There is insufficient space remaining to store the extended attribute.
117 The namespace prefix of
122 Extended attributes are not supported by the filesystem, or are disabled,
125 The file is marked immutable or append-only.
127 .BR ioctl_iflags (2).)
129 In addition, the errors documented in
138 exceeds a filesystem-specific limit.
145 .\" Andreas Gruenbacher,
146 .\" .RI < a.gruenbacher@computer.org >
147 .\" and the SGI XFS development team,
148 .\" .RI < linux-xfs@oss.sgi.com >.
149 .\" Please send any bug reports or comments to these addresses.