1 .\" Copyright (C) Andreas Gruenbacher, February 2001
2 .\" Copyright (C) Silicon Graphics Inc, September 2001
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .TH SETXATTR 2 2019-03-06 "Linux" "Linux Programmer's Manual"
27 setxattr, lsetxattr, fsetxattr \- set an extended attribute value
31 .B #include <sys/types.h>
32 .B #include <sys/xattr.h>
34 .BI "int setxattr(const char\ *" path ", const char\ *" name ,
35 .BI " const void\ *" value ", size_t " size ", int " flags );
36 .BI "int lsetxattr(const char\ *" path ", const char\ *" name ,
37 .BI " const void\ *" value ", size_t " size ", int " flags );
38 .BI "int fsetxattr(int " fd ", const char\ *" name ,
39 .BI " const void\ *" value ", size_t " size ", int " flags );
43 Extended attributes are
46 pairs associated with inodes (files, directories, symbolic links, etc.).
47 They are extensions to the normal attributes which are associated
48 with all inodes in the system (i.e., the
51 A complete overview of extended attributes concepts can be found in
57 of the extended attribute identified by
59 and associated with the given
64 argument specifies the size (in bytes) of
66 a zero-length value is permitted.
71 except in the case of a symbolic link, where the extended attribute is
72 set on the link itself, not the file that it refers to.
77 only the extended attribute is set on the open file referred to by
84 An extended attribute name is a null-terminated string.
87 includes a namespace prefix; there may be several, disjoint
88 namespaces associated with an individual inode.
91 of an extended attribute is a chunk of arbitrary textual or
92 binary data of specified length.
98 the extended attribute will be created if it does not exist,
99 or the value will be replaced if the attribute already exists.
100 To modify these semantics, one of the following values can be specified in
104 Perform a pure create, which fails if the named attribute exists already.
107 Perform a pure replace operation,
108 which fails if the named attribute does not already exist.
110 On success, zero is returned.
111 On failure, \-1 is returned and
113 is set appropriately.
117 Disk quota limits meant that
118 there is insufficient space remaining to store the extended attribute.
122 was specified, and the attribute exists already.
126 was specified, and the attribute does not exist.
128 .\" is defined to be a synonym for
131 .\" .IR <attr/attributes.h> .)
134 There is insufficient space remaining to store the extended attribute.
137 The namespace prefix of
142 Extended attributes are not supported by the filesystem, or are disabled,
145 The file is marked immutable or append-only.
147 .BR ioctl_iflags (2).)
149 In addition, the errors documented in
158 exceeds a filesystem-specific limit.
160 These system calls have been available on Linux since kernel 2.4;
161 glibc support is provided since version 2.3.
163 These system calls are Linux-specific.
165 .\" Andreas Gruenbacher,
166 .\" .RI < a.gruenbacher@computer.org >
167 .\" and the SGI XFS development team,
168 .\" .RI < linux-xfs@oss.sgi.com >.
169 .\" Please send any bug reports or comments to these addresses.