1 .\" $NetBSD: extattr_get_file.2,v 1.5 2011/08/03 09:48:12 wiz Exp $
3 .\" Copyright (c) 2001 Dima Dorfman <dima@unixfreak.org>
4 .\" Copyright (c) 2003 Robert Watson <rwatson@FreeBSD.org>
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" FreeBSD: src/lib/libc/sys/extattr_get_file.2,v 1.14 2004/07/05 17:12:52 ru Exp
31 .Dt EXTATTR_GET_FILE 2
36 .Nm extattr_delete_fd ,
38 .Nm extattr_get_file ,
39 .Nm extattr_set_file ,
40 .Nm extattr_delete_file ,
41 .Nm extattr_list_file ,
42 .Nm extattr_get_link ,
43 .Nm extattr_set_link ,
44 .Nm extattr_delete_link ,
46 .Nd system calls to manipulate VFS extended attributes
53 .Fn extattr_get_fd "int fd" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
55 .Fn extattr_set_fd "int fd" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
57 .Fn extattr_delete_fd "int fd" "int attrnamespace" "const char *attrname"
59 .Fn extattr_list_fd "int fd" "int attrnamespace" "void *data" "size_t nbytes"
61 .Fn extattr_get_file "const char *path" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
63 .Fn extattr_set_file "const char *path" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
65 .Fn extattr_delete_file "const char *path" "int attrnamespace" "const char *attrname"
67 .Fn extattr_list_file "const char *path" "int attrnamespace" "void *data" "size_t nbytes"
69 .Fn extattr_get_link "const char *path" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
71 .Fn extattr_set_link "const char *path" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
73 .Fn extattr_delete_link "const char *path" "int attrnamespace" "const char *attrname"
75 .Fn extattr_list_link "const char *path" "int attrnamespace" "void *data" "size_t nbytes"
77 Named extended attributes are meta-data associated with vnodes
78 representing files and directories.
81 pairs within a set of namespaces.
85 system call retrieves the value of the specified extended attribute into
86 a buffer pointed to by
92 system call sets the value of the specified extended attribute to the data
96 .Fn extattr_delete_file
97 system call deletes the extended attribute specified.
100 returns a list of attributes present in the requested namespace.
101 Each list entry consists of a single byte containing the length
102 of the attribute name, followed by the attribute name.
103 The attribute name is not terminated by ASCII 0 (nul).
107 .Fn extattr_list_file
112 arguments in the style of
115 consumes these arguments in the style of
124 then the size of defined extended attribute data will be returned, rather
125 than the quantity read, permitting applications to test the size of the
126 data without performing a read.
129 .Fn extattr_delete_link ,
130 .Fn extattr_get_link ,
133 system calls behave in the same way as their _file counterparts, except that
134 they do not follow symlinks.
140 .Fn extattr_delete_fd
141 calls are identical to their
143 counterparts except for the first argument.
146 functions take a file descriptor, while the
148 functions take a path.
149 Both arguments describe a file associated with the extended attribute
150 that should be manipulated.
152 The following arguments are common to all the system calls described here:
153 .Bl -tag -width attrnamespace
155 the namespace in which the extended attribute resides; see
158 the name of the extended attribute
161 Named extended attribute semantics vary by file system implementing the call.
162 Not all operations may be supported for a particular attribute.
163 Additionally, the format of the data in
165 is attribute-specific.
167 For more information on named extended attributes, please see
174 calls return the number of bytes
175 that were read or written from the
183 returns the number of bytes available to read.
184 If any of the calls are unsuccessful, the value \-1 is returned
185 and the global variable
187 is set to indicate the error.
189 .Rv -std extattr_delete_file
191 The following errors may be returned by the system calls themselves.
192 Additionally, the file system implementing the call may return any
193 other errors it desires.
201 or the memory range defined by
205 point outside the process's allocated address space.
206 .It Bq Er ENAMETOOLONG
207 The attribute name was longer than
208 .Dv EXTATTR_MAXNAMELEN .
215 .Fn extattr_delete_fd
216 system calls may also fail if:
219 The file descriptor referenced by
225 .Fn extattr_get_file ,
226 .Fn extattr_set_file ,
228 .Fn extattr_delete_file
229 calls may also fail due to the following errors:
232 Search permission is denied for a component of the path prefix.
233 .It Bq Er ENAMETOOLONG
234 A component of a pathname exceeded 255 characters,
235 or an entire path name exceeded 1023 characters.
237 A component of the path name that must exist does not exist.
239 A component of the path prefix is not a directory.
240 .\" XXX are any missing?
247 Extended attribute support was developed as part of the
249 Project, and introduced in
253 It was developed to support security extensions requiring additional labels
254 to be associated with each file or directory.
256 This interface is under active development, and as such is subject to
257 change as applications are adapted to use it.
258 Developers are discouraged from relying on its stability.
260 Note that previous versions of this man page incorrectly stated that
261 .Fn extattr_list_file
262 returned a list of attribute names separated by ASCII 0 (nul).