2 .\" Copyright (c) 2008 Apple Inc. All rights reserved.
4 .\" @APPLE_LICENSE_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. Please obtain a copy of the License at
10 .\" http://www.opensource.apple.com/apsl/ and read it before using this
13 .\" The Original Code and all software distributed under the License are
14 .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 .\" Please see the License for the specific language governing rights and
19 .\" limitations under the License.
21 .\" @APPLE_LICENSE_HEADER_END@
24 .\" $NetBSD: copy.9,v 1.2 1996/01/09 03:23:04 thorpej Exp $
26 .\" Copyright (c) 1996 Jason R. Thorpe.
27 .\" All rights reserved.
29 .\" This code is derived from software contributed by Kenneth Stailey.
31 .\" Redistribution and use in source and binary forms, with or without
32 .\" modification, are permitted provided that the following conditions
34 .\" 1. Redistributions of source code must retain the above copyright
35 .\" notice, this list of conditions and the following disclaimer.
36 .\" 2. Redistributions in binary form must reproduce the above copyright
37 .\" notice, this list of conditions and the following disclaimer in the
38 .\" documentation and/or other materials provided with the distribution.
39 .\" 3. All advertising materials mentioning features or use of this software
40 .\" must display the following acknowledgement:
41 .\" This product includes software developed for the NetBSD Project
42 .\" by Jason R. Thorpe.
43 .\" 4. The name of the author may not be used to endorse or promote products
44 .\" derived from this software without specific prior written permission.
46 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
47 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
48 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
49 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
50 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
51 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
52 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
53 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 .\" $FreeBSD: src/share/man/man9/copy.9,v 1.6.2.5 2001/12/17 11:30:18 ru Exp $
69 .Nd kernel copy functions
75 .Fa "const void *uaddr"
81 .Fa "const void *uaddr"
88 .Fa "const void *kaddr"
94 .\" .Fa "const void *kaddr"
97 .\" .Fa "size_t *done"
101 .Fa "const void *kfaddr"
109 functions are designed to copy contiguous data from one address
112 copy data from user-space to kernel-space or vice-versa.
116 routines provide the following functionality:
117 .Bl -tag -width "copyoutstr()"
122 bytes of data from the user-space address
124 to the kernel-space address
128 Copies a NUL-terminated string, at most
130 bytes long, from user-space address
132 to kernel-space address
134 The number of bytes actually copied, including the terminating
141 bytes of data from the kernel-space address
143 to the user-space address
146 .\" .It Fn copyoutstr
147 .\" Copies a NUL-terminated string, at most
148 .\" bytes long, from kernel-space address
150 .\" to user-space address
152 .\" The number of bytes actually copied, including the terminating
153 .\" NUL, is returned in
157 Copies a NUL-terminated string, at most
159 bytes long, from kernel-space address
161 to kernel-space address
163 The number of bytes actually copied, including the terminating
170 functions return 0 on success or the following error on failure:
174 If a bad address is encountered. When this error is returned, the contents of the destination buffer (
190 parameter are also undefined on a return of EFAULT.
193 In addition to EFAULT,
201 on failure will return:
205 When the string is longer than
207 bytes. On this error return, the destination buffer is not null-terminated, but the
209 parameter is maintained.