1 .\" $NetBSD: extattr_copy_file.3,v 1.2 2011/12/16 15:21:13 manu Exp $
3 .\" Copyright (c) 2001 Dima Dorfman <dd@FreeBSD.org>
4 .\" Copyright (c) 2011 Emmanuel Dreyfus <manu@NetBSD.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/posix1e/extattr.3,v 1.5 2002/12/12 17:25:53 ru Exp
31 .Dt EXTATTR_COPY_FILE 3
34 .Nm extattr_copy_file ,
36 .Nm extattr_copy_link ,
40 .Nd copy extended attributes from a file to another one
46 .Fn extattr_copy_file "const char *from" "const char *to" "int namespace"
48 .Fn extattr_copy_fd "int from_fd" "int to_fd" "int namespace"
50 .Fn extattr_copy_link "const char *from" "const char *to" "int namespace"
52 .Fn cpxattr "const char *from" "const char *to"
54 .Fn fcpxattr "int from_fd" "int to_fd"
56 .Fn lcpxattr "const char *from" "const char *to"
59 copies extended attributes of namespace
61 from a file to another one.
63 does the same using open file descriptors, and
67 but operates on symbolic links themselves instead of their targets.
73 respectively work the same was as
74 .Fn extattr_copy_file ,
77 .Fn extattr_copy_link ,
78 but will copy extended attributes from all namespaces accessible to the user,
79 silently skiping unaccessible namespaces.
81 Please note that none of the extended attribute copying functions are atomic.
83 If any of the calls are unsuccessful, the value \-1 is returned
84 and the global variable
86 is set to indicate the error.
88 Extended attribute copying functions may raise errors produced by
89 .Xr extattr_list_file 2
91 .Xr extattr_get_file 2 .
94 .Xr extattr_get_file 2 ,
95 .Xr extattr_namespace_to_string 3 ,
98 Extended attribute support was developed as part of the
100 Project, and introduced in
104 It was developed to support security extensions requiring additional labels
105 to be associated with each file or directory.