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 LISTXATTR 2 2014-02-06 "Linux" "Linux Programmer's Manual"
27 listxattr, llistxattr, flistxattr \- list extended attribute names
31 .B #include <sys/types.h>
32 .B #include <sys/xattr.h>
34 .BI "ssize_t listxattr(const char\ *" path ", char\ *" list \
36 .BI "ssize_t llistxattr(const char\ *" path ", char\ *" list \
38 .BI "ssize_t flistxattr(int " fd ", char\ *" list ", size_t " size );
42 Extended attributes are name:value
43 pairs associated with inodes (files, directories, symbolic links, etc.).
44 They are extensions to the normal attributes which are associated
45 with all inodes in the system (i.e., the
48 A complete overview of extended attributes concepts can be found in
53 of extended attribute names associated with the given
56 The retrieved list is placed in
58 a caller-allocated buffer whose size (in bytes) is specified in the argument
60 The list is the set of (null-terminated) names, one after the other.
61 Names of extended attributes to which the calling process does not
62 have access may be omitted from the list.
63 The length of the attribute name
70 except in the case of a symbolic link, where the list of names of
71 extended attributes associated with the link itself is retrieved,
72 not the file that it refers to.
77 only the open file referred to by
81 is interrogated in place of
84 A single extended attribute
86 is a simple null-terminated string.
87 The name includes a namespace prefix; there may be several, disjoint
88 namespaces associated with an individual inode.
92 zero can be passed into these calls to return the current size of the
93 list of extended attribute names, which can be used to estimate the
94 size of a buffer which is sufficiently large to hold the list of names.
98 of names is returned as an unordered array of null-terminated character
99 strings (attribute names are separated by null bytes (\(aq\\0\(aq)), like this:
104 user.name1\\0system.name1\\0user.name2\\0
109 Filesystems like ext2, ext3 and XFS which implement POSIX ACLs using
110 extended attributes, might return a
117 system.posix_acl_access\\0system.posix_acl_default\\0
122 On success, a nonnegative number is returned indicating the size of the
123 extended attribute name list.
124 On failure, \-1 is returned and
126 is set appropriately.
130 Extended attributes are not supported by the filesystem, or are disabled.
137 buffer is too small to hold the result.
139 In addition, the errors documented in
143 These system calls have been available on Linux since kernel 2.4;
144 glibc support is provided since version 2.3.
146 These system calls are Linux-specific.
148 .\" Andreas Gruenbacher,
149 .\" .RI < a.gruenbacher@computer.org >
150 .\" and the SGI XFS development team,
151 .\" .RI < linux-xfs@oss.sgi.com >.
152 .\" Please send any bug reports or comments to these addresses.