| @@ -1,110 +1,105 @@ | | | @@ -1,110 +1,105 @@ |
1 | .\" $NetBSD: extattr_copy_file.3,v 1.1 2011/12/16 12:46:00 wiz Exp $ | | 1 | .\" $NetBSD: extattr_copy_file.3,v 1.2 2011/12/16 15:21:13 manu Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2001 Dima Dorfman <dd@FreeBSD.org> | | 3 | .\" Copyright (c) 2001 Dima Dorfman <dd@FreeBSD.org> |
4 | .\" Copyright (c) 2011 Emmanuel Dreyfus <manu@NetBSD.org> | | 4 | .\" Copyright (c) 2011 Emmanuel Dreyfus <manu@NetBSD.org> |
5 | .\" All rights reserved. | | 5 | .\" All rights reserved. |
6 | .\" | | 6 | .\" |
7 | .\" Redistribution and use in source and binary forms, with or without | | 7 | .\" Redistribution and use in source and binary forms, with or without |
8 | .\" modification, are permitted provided that the following conditions | | 8 | .\" modification, are permitted provided that the following conditions |
9 | .\" are met: | | 9 | .\" are met: |
10 | .\" 1. Redistributions of source code must retain the above copyright | | 10 | .\" 1. Redistributions of source code must retain the above copyright |
11 | .\" notice, this list of conditions and the following disclaimer. | | 11 | .\" notice, this list of conditions and the following disclaimer. |
12 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer in the | | 13 | .\" notice, this list of conditions and the following disclaimer in the |
14 | .\" documentation and/or other materials provided with the distribution. | | 14 | .\" documentation and/or other materials provided with the distribution. |
15 | .\" | | 15 | .\" |
16 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | | 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 | | 17 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
18 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 18 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
19 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 19 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
20 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 20 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
21 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 21 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
22 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 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 | | 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 | | 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 | | 25 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | .\" SUCH DAMAGE. | | 26 | .\" SUCH DAMAGE. |
27 | .\" | | 27 | .\" |
28 | .\" FreeBSD: src/lib/libc/posix1e/extattr.3,v 1.5 2002/12/12 17:25:53 ru Exp | | 28 | .\" FreeBSD: src/lib/libc/posix1e/extattr.3,v 1.5 2002/12/12 17:25:53 ru Exp |
29 | .\" | | 29 | .\" |
30 | .Dd December 16, 2011 | | 30 | .Dd December 16, 2011 |
31 | .Dt EXTATTR_COPY_FILE 3 | | 31 | .Dt EXTATTR_COPY_FILE 3 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm extattr_copy_file , | | 34 | .Nm extattr_copy_file , |
35 | .Nm extattr_copy_fd , | | 35 | .Nm extattr_copy_fd , |
36 | .Nm extattr_copy_link , | | 36 | .Nm extattr_copy_link , |
37 | .Nm cpxattr , | | 37 | .Nm cpxattr , |
38 | .Nm fcpxattr , | | 38 | .Nm fcpxattr , |
39 | .Nm lcpxattr | | 39 | .Nm lcpxattr |
40 | .Nd copy extended attributes from a file to another one | | 40 | .Nd copy extended attributes from a file to another one |
41 | .Sh LIBRARY | | 41 | .Sh LIBRARY |
42 | .Lb libc | | 42 | .Lb libc |
43 | .Sh SYNOPSIS | | 43 | .Sh SYNOPSIS |
44 | .In sys/extattr.h | | 44 | .In sys/extattr.h |
45 | .Ft int | | 45 | .Ft int |
46 | .Fn extattr_copy_file "const char *from" "const char *to" "int namespace" | | 46 | .Fn extattr_copy_file "const char *from" "const char *to" "int namespace" |
47 | .Ft int | | 47 | .Ft int |
48 | .Fn extattr_copy_fd "int from_fd" "int to_fd" "int namespace" | | 48 | .Fn extattr_copy_fd "int from_fd" "int to_fd" "int namespace" |
49 | .Ft int | | 49 | .Ft int |
50 | .Fn extattr_copy_link "const char *from" "const char *to" "int namespace" | | 50 | .Fn extattr_copy_link "const char *from" "const char *to" "int namespace" |
51 | .Ft int | | 51 | .Ft int |
52 | .Fn cpxattr "const char *from" "const char *to" | | 52 | .Fn cpxattr "const char *from" "const char *to" |
53 | .Ft int | | 53 | .Ft int |
54 | .Fn fcpxattr "int from_fd" "int to_fd" | | 54 | .Fn fcpxattr "int from_fd" "int to_fd" |
55 | .Ft int | | 55 | .Ft int |
56 | .Fn lcpxattr "const char *from" "const char *to" | | 56 | .Fn lcpxattr "const char *from" "const char *to" |
57 | .Sh DESCRIPTION | | 57 | .Sh DESCRIPTION |
58 | .Fn extattr_copy_file | | 58 | .Fn extattr_copy_file |
59 | copies extended attributes of namespace | | 59 | copies extended attributes of namespace |
60 | .Ar namespace | | 60 | .Ar namespace |
61 | from a file to another one. | | 61 | from a file to another one. |
62 | .Fn extattr_copy_fd | | 62 | .Fn extattr_copy_fd |
63 | does the same using open file descriptors, and | | 63 | does the same using open file descriptors, and |
64 | .Fn extattr_copy_link | | 64 | .Fn extattr_copy_link |
65 | does the same as | | 65 | does the same as |
66 | .Fn extattr_copy_file | | 66 | .Fn extattr_copy_file |
67 | but operates on symbolic links themselves instead of their targets. | | 67 | but operates on symbolic links themselves instead of their targets. |
68 | .Pp | | 68 | .Pp |
69 | .Fn cpxattr , | | 69 | .Fn cpxattr , |
70 | .Fn fcpxattr , | | 70 | .Fn fcpxattr , |
71 | and | | 71 | and |
72 | .Fn lcpxattr | | 72 | .Fn lcpxattr |
73 | respectively work the same was as | | 73 | respectively work the same was as |
74 | .Fn extattr_copy_file , | | 74 | .Fn extattr_copy_file , |
75 | .Fn extattr_copy_fd , | | 75 | .Fn extattr_copy_fd , |
76 | and | | 76 | and |
77 | .Fn extattr_copy_link , | | 77 | .Fn extattr_copy_link , |
78 | but will copy extended attributes from all namespaces accessible to the user, | | 78 | but will copy extended attributes from all namespaces accessible to the user, |
79 | silently skiping unaccessible namespaces. | | 79 | silently skiping unaccessible namespaces. |
80 | .Pp | | 80 | .Pp |
81 | Please note that none of the extended attribute copying functions are atomic. | | 81 | Please note that none of the extended attribute copying functions are atomic. |
82 | .Sh RETURN VALUES | | 82 | .Sh RETURN VALUES |
83 | If any of the calls are unsuccessful, the value \-1 is returned | | 83 | If any of the calls are unsuccessful, the value \-1 is returned |
84 | and the global variable | | 84 | and the global variable |
85 | .Va errno | | 85 | .Va errno |
86 | is set to indicate the error. | | 86 | is set to indicate the error. |
87 | .Sh ERRORS | | 87 | .Sh ERRORS |
88 | .Bl -tag -width Er | | 88 | Extended attribute copying functions may raise errors produced by |
89 | .It Bq Er EINVAL | | 89 | .Xr extattr_list_file 2 |
90 | The requested namespace could not be identified. | | | |
91 | .El | | | |
92 | .Pp | | | |
93 | Extended attribute copying functions may also raise errors produced by | | | |
94 | .Fn extattr_list_file | | | |
95 | and | | 90 | and |
96 | .Fn extattr_get_file . | | 91 | .Xr extattr_get_file 2 . |
97 | .Sh SEE ALSO | | 92 | .Sh SEE ALSO |
98 | .Xr getextattr 1 , | | 93 | .Xr getextattr 1 , |
99 | .Xr extattr_get_file 2 , | | 94 | .Xr extattr_get_file 2 , |
100 | .Xr extattr_namespace_to_string 3 , | | 95 | .Xr extattr_namespace_to_string 3 , |
101 | .Xr extattr 9 | | 96 | .Xr extattr 9 |
102 | .Sh HISTORY | | 97 | .Sh HISTORY |
103 | Extended attribute support was developed as part of the | | 98 | Extended attribute support was developed as part of the |
104 | .Tn TrustedBSD | | 99 | .Tn TrustedBSD |
105 | Project, and introduced in | | 100 | Project, and introduced in |
106 | .Fx 5.0 | | 101 | .Fx 5.0 |
107 | and | | 102 | and |
108 | .Nx 3.0 . | | 103 | .Nx 3.0 . |
109 | It was developed to support security extensions requiring additional labels | | 104 | It was developed to support security extensions requiring additional labels |
110 | to be associated with each file or directory. | | 105 | to be associated with each file or directory. |