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 GETXATTR 2 2021-03-22 "Linux man-pages (unreleased)"
8 getxattr, lgetxattr, fgetxattr \- retrieve an extended attribute value
11 .RI ( libc ", " \-lc )
14 .B #include <sys/xattr.h>
16 .BI "ssize_t getxattr(const char *" path ", const char *" name ,
17 .BI " void *" value ", size_t " size );
18 .BI "ssize_t lgetxattr(const char *" path ", const char *" name ,
19 .BI " void *" value ", size_t " size );
20 .BI "ssize_t fgetxattr(int " fd ", const char *" name ,
21 .BI " void *" value ", size_t " size );
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
36 retrieves the value of the extended attribute identified by
38 and associated with the given
41 The attribute value is placed in the buffer pointed to by
44 specifies the size of that buffer.
45 The return value of the call is the number of bytes placed in
51 except in the case of a symbolic link, where the link itself is
52 interrogated, not the file that it refers to.
57 only the open file referred to by
61 is interrogated in place of
66 is a null-terminated string.
67 The name includes a namespace prefix; there may be several, disjoint
68 namespaces associated with an individual inode.
69 The value of an extended attribute is a chunk of arbitrary textual or
70 binary data that was assigned using
75 is specified as zero, these calls return the current size of the
76 named extended attribute (and leave
79 This can be used to determine the size of the buffer that
80 should be supplied in a subsequent call.
81 (But, bear in mind that there is a possibility that the
82 attribute value may change between the two calls,
83 so that it is still necessary to check the return status
84 from the second call.)
86 On success, these calls return a nonnegative value which is
87 the size (in bytes) of the extended attribute value.
88 On failure, \-1 is returned and
90 is set to indicate the error.
94 The size of the attribute value is larger than the maximum size allowed; the
95 attribute cannot be retrieved.
96 This can happen on filesystems that support
97 very large attribute values such as NFSv4, for example.
100 The named attribute does not exist, or the process has no access to
103 .\" is defined to be a synonym for
106 .\" .IR <attr/attributes.h> .)
109 Extended attributes are not supported by the filesystem, or are disabled.
116 buffer is too small to hold the result.
118 In addition, the errors documented in
122 These system calls have been available on Linux since kernel 2.4;
123 glibc support is provided since version 2.3.
125 These system calls are Linux-specific.
127 .\" Andreas Gruenbacher,
128 .\" .RI < a.gruenbacher@computer.org >
129 .\" and the SGI XFS development team,
130 .\" .RI < linux-xfs@oss.sgi.com >.
131 .\" Please send any bug reports or comments to these addresses.