|
AquilaOS documentation
How it works, and its code
|
Go to the source code of this file.
Macros | |
| #define | UACCESS_LIMIT ((uintptr_t) USER_STACK) |
Functions | |
| static int | uaccess_check (const void *ptr, size_t len) |
| Checks that [ptr, ptr + len) is in user space. | |
| size_t | arch_copy_user (void *dst, const void *src, size_t n) |
| long | arch_copy_user_str (char *dst, const char *src, size_t max) |
| static int | copyin (void *kdst, const void *usrc, size_t n) |
| Copies n bytes from user memory at usrc to kdst. | |
| static int | copyout (void *udst, const void *ksrc, size_t n) |
| Copies n bytes from ksrc to user memory at udst. | |
| static size_t | copyin_upto (void *kdst, const void *usrc, size_t n) |
| Copies as copyin() does, but returns how many bytes were copied before a fault (0 for a range that isn't in user space): n if they all were. | |
| static size_t | copyout_upto (void *udst, const void *ksrc, size_t n) |
| Copies as copyout() does, but returns how many bytes were copied before a fault: n if they all were. | |
| static long | copyinstr (char *kdst, const char *usrc, size_t max) |
| Copies a string from user memory at usrc to kdst (at most max bytes, its NUL included). | |
| #define UACCESS_LIMIT ((uintptr_t) USER_STACK) |
Definition at line 20 of file uaccess.h.
Referenced by copyinstr(), and uaccess_check().
References arch_copy_user().
Referenced by arch_copy_user(), copyin(), copyin_upto(), copyout(), and copyout_upto().
| long arch_copy_user_str | ( | char * | dst, |
| const char * | src, | ||
| size_t | max ) |
References arch_copy_user_str().
Referenced by arch_copy_user_str(), and copyinstr().
|
inlinestatic |
Copies n bytes from user memory at usrc to kdst.
Returns 0, or -EFAULT.
Definition at line 48 of file uaccess.h.
References arch_copy_user(), and uaccess_check().
Copies as copyin() does, but returns how many bytes were copied before a fault (0 for a range that isn't in user space): n if they all were.
Definition at line 68 of file uaccess.h.
References arch_copy_user(), and uaccess_check().
|
inlinestatic |
Copies a string from user memory at usrc to kdst (at most max bytes, its NUL included).
Returns its length, -EFAULT, or -ENAMETOOLONG if it doesn't fit.
Definition at line 83 of file uaccess.h.
References arch_copy_user_str(), MIN, and UACCESS_LIMIT.
|
inlinestatic |
Copies n bytes from ksrc to user memory at udst.
Returns 0, or -EFAULT.
Definition at line 58 of file uaccess.h.
References arch_copy_user(), and uaccess_check().
Copies as copyout() does, but returns how many bytes were copied before a fault: n if they all were.
Definition at line 75 of file uaccess.h.
References arch_copy_user(), and uaccess_check().
|
inlinestatic |
Checks that [ptr, ptr + len) is in user space.
Returns 0 if it is, or -EFAULT. A NULL pointer is always rejected unless len is 0, so callers that accept NULL must test for it first.
Definition at line 27 of file uaccess.h.
References uaccess_check(), and UACCESS_LIMIT.
Referenced by copyin(), copyin_upto(), copyout(), copyout_upto(), sys_getrandom(), sys_mmap(), sys_pipe(), sys_read(), sys_readlinkat(), sys_recv(), sys_send(), sys_sigaction(), sys_thread_create(), sys_write(), and uaccess_check().