2 .\" Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 .\" @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 .\" This file contains Original Code and/or Modifications of Original Code
7 .\" as defined in and that are subject to the Apple Public Source License
8 .\" Version 2.0 (the "License"). You may not use this file except in
9 .\" compliance with the License. The rights granted to you under the
10 .\" License may not be used to create, or enable the creation or
11 .\" redistribution of, unlawful or unlicensed copies of an Apple operating
12 .\" system, or to circumvent, violate, or enable the circumvention or
13 .\" violation of, any terms of an Apple operating system software license
16 .\" Please obtain a copy of the License at
17 .\" http://www.opensource.apple.com/apsl/ and read it before using this
20 .\" The Original Code and all software distributed under the License are
21 .\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 .\" Please see the License for the specific language governing rights and
26 .\" limitations under the License.
28 .\" @APPLE_LICENSE_OSREFERENCE_HEADER_END@
36 .Nd list an extended attribute value
38 .Fd #include <sys/xattr.h>
40 .Fn listxattr "const char *path" "char *namebuf" "size_t size" "int options"
42 .Fn flistxattr "int fd" "char *namebuf" "size_t size" "int options"
44 Extended attributes extend the basic attributes associated with files and
45 directories in the file system. They are stored as name:data pairs associated
46 with file system objects (files, directories, symlinks, etc).
49 retrieves a list of names of extended attributes associated with the given
56 bytes for the names of the extended attributes associated with
58 The extended attribute names are simple NULL-terminated UTF-8 strings and
59 are returned in arbitrary order. No extra padding is provided between
60 names in the buffer. The list will only include names of extended
61 attributes to which the calling process has access. The function returns
62 the size of the list of names.
65 controls how the attribute list is generated:
67 .Bl -tag -width XATTR_NOFOLLOW
69 do not follow symbolic links.
71 normally lists attributes of the target of
73 if it is a symbolic link. With this option,
75 will list attributes of the link itself.
81 the function returns the size of the list of extended attribute names.
82 This facility can be used to determine the size of a buffer sufficiently
83 large to hold the names of the attributes currently associated with
89 except that it returns the list of extended attribute names associated
90 with the open file referenced by file descriptor
93 On success, the size of the extended attribute name list is returned. If
94 no accessible extended attributes are associated with the given
98 the function returns zero. On failure, -1 is returned and the global
105 The file system does not support extended attributes or has the feature
111 is too small to hold the list of names.
116 refer to a file system object that does not support extended attributes.
117 For example, resource forks don't support extended attributes.
118 .\" If only EFTYPE was a POSIX error
122 prefix is not a directory.
123 .It Bq Er ENAMETOOLONG
127 UTF-8 bytes, or a component of
131 characters, or the entire
137 Search permission is denied for a component of
139 or permission is denied to read the list of attributes from this file.
141 Too many symbolic links were encountered resolving
145 points to an invalid address.
147 An I/O error occurred.
160 first appeared in Mac OS X 10.4.