]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/arm/stubs.c
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
5 * Copyright (c) 1997 by Apple Computer, Inc., all rights reserved
6 * Copyright (c) 1993 NeXT Computer, Inc.
10 #include <sys/param.h>
11 #include <sys/systm.h>
12 #include <sys/ioctl.h>
15 #include <sys/kauth.h>
16 #include <sys/ucred.h>
17 #include <sys/proc_internal.h>
19 #include <kern/task.h>
20 #include <kern/thread.h>
21 #include <vm/vm_map.h>
24 * copy a null terminated string from the kernel address space into the user
25 * address space. - if the user is denied write access, return EFAULT. - if
26 * the end of string isn't found before maxlen bytes are copied, return
27 * ENAMETOOLONG, indicating an incomplete copy. - otherwise, return 0,
28 * indicating success. the number of bytes copied is always returned in
32 copyoutstr(const void *from
, user_addr_t to
, size_t maxlen
, size_t * lencopied
)
38 slen
= strlen(from
) + 1;
42 len
= min(maxlen
, slen
);
43 if (copyout(from
, to
, len
))
52 * copy a null terminated string from one point to another in the kernel
53 * address space. - no access checks are performed. - if the end of string
54 * isn't found before maxlen bytes are copied, return ENAMETOOLONG,
55 * indicating an incomplete copy. - otherwise, return 0, indicating success.
56 * the number of bytes copied is always returned in lencopied.
58 /* from ppc/fault_copy.c -Titan1T4 VERSION */
60 copystr(const void *vfrom
, void *vto
, size_t maxlen
, size_t * lencopied
)
63 char const *from
= (char const *) vfrom
;
64 char *to
= (char *) vto
;
66 for (l
= 0; l
< maxlen
; l
++) {
67 if ((*to
++ = *from
++) == '\0') {
79 copywithin(void *src
, void *dst
, size_t count
)
81 bcopy(src
, dst
, count
);