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 GETXATTR 2 2014-04-06 "Linux" "Linux Programmer's Manual"
27 getxattr, lgetxattr, fgetxattr \- retrieve an extended attribute value
31 .B #include <sys/types.h>
32 .B #include <sys/xattr.h>
34 .BI "ssize_t getxattr(const char\ *" path ", const char\ *" name ,
35 .BI " void\ *" value ", size_t " size );
36 .BI "ssize_t lgetxattr(const char\ *" path ", const char\ *" name ,
37 .BI " void\ *" value ", size_t " size );
38 .BI "ssize_t fgetxattr(int " fd ", const char\ *" name ,
39 .BI " void\ *" value ", size_t " size );
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
62 The length of the attribute
69 except in the case of a symbolic link, where the link itself is
70 interrogated, not the file that it refers to.
75 only the open file referred to by
79 is interrogated in place of
84 is a simple null-terminated string.
85 The name includes a namespace prefix; there may be several, disjoint
86 namespaces associated with an individual inode.
87 The value of an extended attribute is a chunk of arbitrary textual or
88 binary data of specified length.
92 zero can be passed into these calls to return the current size of the
93 named extended attribute, which can be used to estimate the size of a
94 buffer which is sufficiently large to hold the value associated with
95 the extended attribute.
97 The interface is designed to allow guessing of initial buffer
98 sizes, and to enlarge buffers when the return value indicates
99 that the buffer provided was too small.
101 On success, a nonnegative number is returned indicating the size of the
102 extended attribute value.
103 On failure, \-1 is returned and
105 is set appropriately.
109 The named attribute does not exist, or the process has no access to
112 is defined to be a synonym for
115 .IR <attr/xattr.h> .)
118 Extended attributes are not supported by the filesystem, or are disabled.
125 buffer is too small to hold the result.
127 In addition, the errors documented in
131 These system calls have been available on Linux since kernel 2.4;
132 glibc support is provided since version 2.3.
134 These system calls are Linux-specific.
136 .\" Andreas Gruenbacher,
137 .\" .RI < a.gruenbacher@computer.org >
138 .\" and the SGI XFS development team,
139 .\" .RI < linux-xfs@oss.sgi.com >.
140 .\" Please send any bug reports or comments to these addresses.
152 This page is part of release 3.79 of the Linux
155 A description of the project,
156 information about reporting bugs,
157 and the latest version of this page,
159 \%http://www.kernel.org/doc/man\-pages/.