1 .\" $NetBSD: extattr_get_file.2,v 1.3 2005/01/02 18:28:48 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, separated
101 by ASCII 0 (nul) characters.
105 .Fn extattr_list_file
110 arguments in the style of
113 consumes these arguments in the style of
122 then the size of defined extended attribute data will be returned, rather
123 than the quantity read, permitting applications to test the size of the
124 data without performing a read.
127 .Fn extattr_delete_link ,
128 .Fn extattr_get_link ,
131 system calls behave in the same way as their _file counterparts, except that
132 they do not follow symlinks.
138 .Fn extattr_delete_fd
139 calls are identical to their
141 counterparts except for the first argument.
144 functions take a file descriptor, while the
146 functions take a path.
147 Both arguments describe a file associated with the extended attribute
148 that should be manipulated.
150 The following arguments are common to all the system calls described here:
151 .Bl -tag -width attrnamespace
153 the namespace in which the extended attribute resides; see
156 the name of the extended attribute
159 Named extended attribute semantics vary by file system implementing the call.
160 Not all operations may be supported for a particular attribute.
161 Additionally, the format of the data in
163 is attribute-specific.
165 For more information on named extended attributes, please see
172 calls return the number of bytes
173 that were read or written from the
181 returns the number of bytes available to read.
182 If any of the calls are unsuccessful, the value \-1 is returned
183 and the global variable
185 is set to indicate the error.
187 .Rv -std extattr_delete_file
189 The following errors may be returned by the system calls themselves.
190 Additionally, the file system implementing the call may return any
191 other errors it desires.
199 or the memory range defined by
203 point outside the process's allocated address space.
204 .It Bq Er ENAMETOOLONG
205 The attribute name was longer than
206 .Dv EXTATTR_MAXNAMELEN .
213 .Fn extattr_delete_fd
214 system calls may also fail if:
217 The file descriptor referenced by
223 .Fn extattr_get_file ,
224 .Fn extattr_set_file ,
226 .Fn extattr_delete_file
227 calls may also fail due to the following errors:
230 A component of the path prefix is not a directory.
231 .It Bq Er ENAMETOOLONG
232 A component of a pathname exceeded 255 characters,
233 or an entire path name exceeded 1023 characters.
235 A component of the path name that must exist does not exist.
237 Search permission is denied for a component of the path prefix.
238 .\" XXX are any missing?
245 Extended attribute support was developed as part of the
247 Project, and introduced in
251 It was developed to support security extensions requiring additional labels
252 to be associated with each file or directory.
254 This interface is under active development, and as such is subject to
255 change as applications are adapted to use it.
256 Developers are discouraged from relying on its stability.