OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man2 / listxattr.2
1 .\"
2 .\" Extended attributes system calls manual pages
3 .\"
4 .\" Copyright (C) Andreas Gruenbacher, February 2001
5 .\" Copyright (C) Silicon Graphics Inc, September 2001
6 .\"
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.
11 .\"
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.
16 .\"
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.
21 .\"
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,
25 .\" USA.
26 .\"
27 .TH LISTXATTR 2 2001-12-01 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 listxattr, llistxattr, flistxattr \- list extended attribute names
30 .SH SYNOPSIS
31 .fam C
32 .nf
33 .B #include <sys/types.h>
34 .B #include <attr/xattr.h>
35 .sp
36 .BI "ssize_t listxattr(const char\ *" path ", char\ *" list \
37 ", size_t " size );
38 .BI "ssize_t llistxattr(const char\ *" path ", char\ *" list \
39 ", size_t " size );
40 .BI "ssize_t flistxattr(int " fd ", char\ *" list ", size_t " size );
41 .fi
42 .fam T
43 .SH DESCRIPTION
44 Extended attributes are name:value
45 pairs associated with inodes (files, directories, symbolic links, etc.).
46 They are extensions to the normal attributes which are associated
47 with all inodes in the system (i.e., the
48 .BR stat (2)
49 data).
50 A complete overview of extended attributes concepts can be found in
51 .BR attr (5).
52 .PP
53 .BR listxattr ()
54 retrieves the
55 .I list
56 of extended attribute names associated with the given
57 .I path
58 in the file system.
59 The list is the set of (null-terminated) names, one after the other.
60 Names of extended attributes to which the calling process does not
61 have access may be omitted from the list.
62 The length of the attribute name
63 .I list
64 is returned.
65 .PP
66 .BR llistxattr ()
67 is identical to
68 .BR listxattr (),
69 except in the case of a symbolic link, where the list of names of
70 extended attributes associated with the link itself is retrieved,
71 not the file that it refers to.
72 .PP
73 .BR flistxattr ()
74 is identical to
75 .BR listxattr (),
76 only the open file referred to by
77 .I fd
78 (as returned by
79 .BR open (2))
80 is interrogated in place of
81 .IR path .
82 .PP
83 A single extended attribute
84 .I name
85 is a simple null-terminated string.
86 The name includes a namespace prefix; there may be several, disjoint
87 namespaces associated with an individual inode.
88 .PP
89 An empty buffer of
90 .I size
91 zero can be passed into these calls to return the current size of the
92 list of extended attribute names, which can be used to estimate the
93 size of a buffer which is sufficiently large to hold the list of names.
94 .SS Example
95 The
96 .I list
97 of names is returned as an unordered array of null-terminated character
98 strings (attribute names are separated by null bytes (\(aq\\0\(aq)), like this:
99 .fam C
100 .RS
101 .nf
102
103 user.name1\\0system.name1\\0user.name2\\0
104 .fi
105 .RE
106 .fam T
107 .P
108 Filesystems like ext2, ext3 and XFS which implement POSIX ACLs using
109 extended attributes, might return a
110 .I list
111 like this:
112 .fam C
113 .RS
114 .nf
115
116 system.posix_acl_access\\0system.posix_acl_default\\0
117 .fi
118 .RE
119 .fam T
120 .SH RETURN VALUE
121 On success, a positive number is returned indicating the size of the
122 extended attribute name list.
123 On failure, \-1 is returned and
124 .I errno
125 is set appropriately.
126 .PP
127 If the
128 .I size
129 of the
130 .I list
131 buffer is too small to hold the result,
132 .I errno
133 is set to
134 .BR ERANGE .
135 .PP
136 If extended attributes are not supported by the file system, or are disabled,
137 .I errno
138 is set to
139 .BR ENOTSUP .
140 .PP
141 The errors documented for the
142 .BR stat (2)
143 system call are also applicable here.
144 .SH VERSIONS
145 These system calls have been available on Linux since kernel 2.4;
146 glibc support is provided since version 2.3.
147 .SH "CONFORMING TO"
148 These system calls are Linux-specific.
149 .\" .SH AUTHORS
150 .\" Andreas Gruenbacher,
151 .\" .RI < a.gruenbacher@computer.org >
152 .\" and the SGI XFS development team,
153 .\" .RI < linux-xfs@oss.sgi.com >.
154 .\" Please send any bug reports or comments to these addresses.
155 .SH SEE ALSO
156 .BR getfattr (1),
157 .BR setfattr (1),
158 .BR getxattr (2),
159 .BR open (2),
160 .BR removexattr (2),
161 .BR setxattr (2),
162 .BR stat (2),
163 .BR attr (5),
164 .BR symlink (7)