2 .\" Extended attributes system calls manual pages
4 .\" (C) Andreas Gruenbacher, February 2001
5 .\" (C) Silicon Graphics Inc, September 2001
7 .\" This is free documentation; you can redistribute it and/or
8 .\" modify it under the terms of the GNU General Public License as
9 .\" published by the Free Software Foundation; either version 2 of
10 .\" the License, or (at your option) any later version.
12 .\" The GNU General Public License's references to "object code"
13 .\" and "executables" are to be interpreted as the output of any
14 .\" document formatting or typesetting system, including
15 .\" intermediate and printed output.
17 .\" This manual is distributed in the hope that it will be useful,
18 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 .\" GNU General Public License for more details.
22 .\" You should have received a copy of the GNU General Public
23 .\" License along with this manual; if not, write to the Free
24 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
27 .TH SETXATTR 2 2001-12-31 "Extended Attributes" "Linux Programmer's Manual"
29 setxattr, lsetxattr, fsetxattr \- set an extended attribute value
33 .B #include <sys/types.h>
34 .B #include <attr/xattr.h>
36 .BI "int setxattr(const char\ *" path ", const char\ *" name ,
37 .BI " const void\ *" value ", size_t " size ", int " flags );
38 .BI "int lsetxattr(const char\ *" path ", const char\ *" name ,
39 .BI " const void\ *" value ", size_t " size ", int " flags );
40 .BI "int fsetxattr(int " filedes ", const char\ *" name ,
41 .BI " const void\ *" value ", size_t " size ", int " flags );
45 Extended attributes are
48 pairs associated with inodes (files, directories, symlinks, etc).
49 They are extensions to the normal attributes which are associated
50 with all inodes in the system (i.e. the
53 A complete overview of extended attributes concepts can be found in
59 of the extended attribute identified by
61 and associated with the given
73 except in the case of a symbolic link, where the extended attribute is
74 set on the link itself, not the file that it refers to.
79 only the extended attribute is set on the open file pointed to by
86 An extended attribute name is a simple null-terminated string.
89 includes a namespace prefix; there may be several, disjoint
90 namespaces associated with an individual inode.
93 of an extended attribute is a chunk of arbitrary textual or
94 binary data of specified length.
98 parameter can be used to refine the semantics of the operation.
99 XATTR_CREATE specifies a pure create, which fails if the named
100 attribute exists already.
101 XATTR_REPLACE specifies a pure replace operation, which fails if the
102 named attribute does not already exist.
103 By default (no flags), the extended attribute will be created if
104 need be, or will simply replace the value if the attribute exists.
106 On success, zero is returned.
107 On failure, \-1 is returned and
109 is set appropriately.
111 If XATTR_CREATE is specified, and the attribute exists already,
114 If XATTR_REPLACE is specified, and the attribute does not exist,
118 If there is insufficient space remaining to store the extended attribute,
120 is set to either ENOSPC, or EDQUOT if quota enforcement was the cause.
122 If extended attributes are not supported by the filesystem, or are disabled,
126 The errors documented for the
128 system call are also applicable here.
130 These system calls are Linux specific.
132 .\" Andreas Gruenbacher,
133 .\" .RI < a.gruenbacher@computer.org >
134 .\" and the SGI XFS development team,
135 .\" .RI < linux-xfs@oss.sgi.com >.
136 .\" Please send any bug reports or comments to these addresses.