xref: /titanic_52/usr/src/uts/common/syscall/uucopy.c (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
1*9acbbeafSnn35248 /*
2*9acbbeafSnn35248  * CDDL HEADER START
3*9acbbeafSnn35248  *
4*9acbbeafSnn35248  * The contents of this file are subject to the terms of the
5*9acbbeafSnn35248  * Common Development and Distribution License (the "License").
6*9acbbeafSnn35248  * You may not use this file except in compliance with the License.
7*9acbbeafSnn35248  *
8*9acbbeafSnn35248  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9acbbeafSnn35248  * or http://www.opensolaris.org/os/licensing.
10*9acbbeafSnn35248  * See the License for the specific language governing permissions
11*9acbbeafSnn35248  * and limitations under the License.
12*9acbbeafSnn35248  *
13*9acbbeafSnn35248  * When distributing Covered Code, include this CDDL HEADER in each
14*9acbbeafSnn35248  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9acbbeafSnn35248  * If applicable, add the following below this CDDL HEADER, with the
16*9acbbeafSnn35248  * fields enclosed by brackets "[]" replaced with your own identifying
17*9acbbeafSnn35248  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9acbbeafSnn35248  *
19*9acbbeafSnn35248  * CDDL HEADER END
20*9acbbeafSnn35248  */
21*9acbbeafSnn35248 /*
22*9acbbeafSnn35248  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*9acbbeafSnn35248  * Use is subject to license terms.
24*9acbbeafSnn35248  */
25*9acbbeafSnn35248 
26*9acbbeafSnn35248 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*9acbbeafSnn35248 
28*9acbbeafSnn35248 #include <sys/systm.h>
29*9acbbeafSnn35248 
30*9acbbeafSnn35248 int
31*9acbbeafSnn35248 uucopy(const void *from, void *to, size_t size)
32*9acbbeafSnn35248 {
33*9acbbeafSnn35248 	label_t ljb;
34*9acbbeafSnn35248 
35*9acbbeafSnn35248 	if (on_fault(&ljb))
36*9acbbeafSnn35248 		return (set_errno(EFAULT));
37*9acbbeafSnn35248 
38*9acbbeafSnn35248 	ucopy(from, to, size);
39*9acbbeafSnn35248 
40*9acbbeafSnn35248 	no_fault();
41*9acbbeafSnn35248 
42*9acbbeafSnn35248 	return (0);
43*9acbbeafSnn35248 }
44*9acbbeafSnn35248 
45*9acbbeafSnn35248 ssize_t
46*9acbbeafSnn35248 uucopystr(const char *from, char *to, size_t size)
47*9acbbeafSnn35248 {
48*9acbbeafSnn35248 	label_t ljb;
49*9acbbeafSnn35248 	size_t len;
50*9acbbeafSnn35248 
51*9acbbeafSnn35248 	if (on_fault(&ljb))
52*9acbbeafSnn35248 		return (set_errno(EFAULT));
53*9acbbeafSnn35248 
54*9acbbeafSnn35248 	ucopystr(from, to, size, &len);
55*9acbbeafSnn35248 
56*9acbbeafSnn35248 	no_fault();
57*9acbbeafSnn35248 
58*9acbbeafSnn35248 	return ((ssize_t)len);
59*9acbbeafSnn35248 }
60