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 2022-09-18 "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_t " size ", int " flags );
18 .BI "int lsetxattr(const char *" path ", const char *" name ,
19 .BI " const void *" value ", size_t " size ", int " flags );
20 .BI "int fsetxattr(int " fd ", const char *" name ,
21 .BI " const void *" value ", size_t " size ", int " flags );
24 Extended attributes are
27 pairs associated with inodes (files, directories, symbolic links, etc.).
28 They are extensions to the normal attributes which are associated
29 with all inodes in the system (i.e., the
32 A complete overview of extended attributes concepts can be found in
38 of the extended attribute identified by
40 and associated with the given
45 argument specifies the size (in bytes) of
47 a zero-length value is permitted.
52 except in the case of a symbolic link, where the extended attribute is
53 set on the link itself, not the file that it refers to.
58 only the extended attribute is set on the open file referred to by
65 An extended attribute name is a null-terminated string.
68 includes a namespace prefix; there may be several, disjoint
69 namespaces associated with an individual inode.
72 of an extended attribute is a chunk of arbitrary textual or
73 binary data of specified length.
79 the extended attribute will be created if it does not exist,
80 or the value will be replaced if the attribute already exists.
81 To modify these semantics, one of the following values can be specified in
85 Perform a pure create, which fails if the named attribute exists already.
88 Perform a pure replace operation,
89 which fails if the named attribute does not already exist.
91 On success, zero is returned.
92 On failure, \-1 is returned and
94 is set to indicate the error.
98 Disk quota limits meant that
99 there is insufficient space remaining to store the extended attribute.
103 was specified, and the attribute exists already.
107 was specified, and the attribute does not exist.
109 .\" is defined to be a synonym for
112 .\" .IR <attr/attributes.h> .)
115 There is insufficient space remaining to store the extended attribute.
118 The namespace prefix of
123 Extended attributes are not supported by the filesystem, or are disabled,
126 The file is marked immutable or append-only.
128 .BR ioctl_iflags (2).)
130 In addition, the errors documented in
139 exceeds a filesystem-specific limit.
141 These system calls have been available on Linux since kernel 2.4;
142 glibc support is provided since version 2.3.
144 These system calls are Linux-specific.
146 .\" Andreas Gruenbacher,
147 .\" .RI < a.gruenbacher@computer.org >
148 .\" and the SGI XFS development team,
149 .\" .RI < linux-xfs@oss.sgi.com >.
150 .\" Please send any bug reports or comments to these addresses.