Linux Kernel
3.7.1
|
#include <linux/errno.h>
#include <linux/thread_info.h>
#include <asm/page.h>
#include <asm/setup.h>
Go to the source code of this file.
Data Structures | |
struct | exception_table_entry |
struct | __large_struct |
Functions | |
int | fixup_exception (struct pt_regs *regs) |
long | __get_user_bad (void) |
void | __put_user_bad (void) |
unsigned long | __generic_copy_to_user (void __user *, const void *, unsigned long) |
unsigned long | __generic_copy_from_user (void *, const void __user *, unsigned long) |
long __must_check | strncpy_from_user (char *dst, const char __user *src, long count) |
long __must_check | __strncpy_from_user (char *dst, const char __user *src, long count) |
unsigned long | __clear_user (void __user *mem, unsigned long len) |
unsigned long | clear_user (void __user *mem, unsigned long len) |
long | strnlen_user (const char __user *str, long n) |
#define __addr_ok | ( | addr | ) | ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) |
__copy_from_user: - Copy a block of data from user space, with less checking. * : Destination address, in kernel space. : Source address, in user space.
: Number of bytes to copy.
Context: User context only. This function may sleep.
Copy data from user space to kernel space. Caller must check the specified block with access_ok() before calling this function.
Returns number of bytes that could not be copied. On success, this will be zero.
If some data could not be copied, this function will pad the copied data to the requested size using zero bytes.
#define __copy_from_user_inatomic __copy_from_user |
__copy_to_user: - Copy a block of data into user space, with less checking. : Destination address, in user space. : Source address, in kernel space.
: Number of bytes to copy.
Context: User context only. This function may sleep.
Copy data from kernel space to user space. Caller must check the specified block with access_ok() before calling this function.
Returns number of bytes that could not be copied. On success, this will be zero.
#define __copy_to_user_inatomic __copy_to_user |
#define __get_user | ( | x, | |
ptr | |||
) | __get_user_nocheck((x),(ptr),sizeof(*(ptr))) |
__get_user: - Get a simple variable from user space, with less checking. : Variable to store result. : Source address, in user space.
Context: User context only. This function may sleep.
This macro copies a single simple variable from user space to kernel space. It supports simple types like char and int, but not larger data types like structures or arrays.
must have pointer-to-simple-variable type, and the result of dereferencing must be assignable to without a cast.
Caller must check the pointer with access_ok() before calling this function.
Returns zero on success, or -EFAULT on error. On error, the variable is set to zero.
__put_user: - Write a simple value into user space, with less checking. : Value to copy to user space. : Destination address, in user space.
Context: User context only. This function may sleep.
This macro copies a single simple value from kernel space to user space. It supports simple types like char and int, but not larger data types like structures or arrays.
must have pointer-to-simple-variable type, and must be assignable to the result of dereferencing .
Caller must check the pointer with access_ok() before calling this function.
Returns zero on success, or -EFAULT on error.
copy_from_user: - Copy a block of data from user space. : Destination address, in kernel space. : Source address, in user space.
: Number of bytes to copy.
Context: User context only. This function may sleep.
Copy data from user space to kernel space.
Returns number of bytes that could not be copied. On success, this will be zero.
If some data could not be copied, this function will pad the copied data to the requested size using zero bytes.
copy_to_user: - Copy a block of data into user space. : Destination address, in user space. : Source address, in kernel space.
: Number of bytes to copy.
Context: User context only. This function may sleep.
Copy data from kernel space to user space.
Returns number of bytes that could not be copied. On success, this will be zero.
get_user: - Get a simple variable from user space. : Variable to store result. : Source address, in user space.
Context: User context only. This function may sleep.
This macro copies a single simple variable from user space to kernel space. It supports simple types like char and int, but not larger data types like structures or arrays.
must have pointer-to-simple-variable type, and the result of dereferencing must be assignable to without a cast.
Returns zero on success, or -EFAULT on error. On error, the variable is set to zero.
#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) |
#define MAKE_MM_SEG | ( | s | ) | ((mm_segment_t) { (s) }) |
put_user: - Write a simple value into user space. : Value to copy to user space. : Destination address, in user space.
Context: User context only. This function may sleep.
This macro copies a single simple value from kernel space to user space. It supports simple types like char and int, but not larger data types like structures or arrays.
must have pointer-to-simple-variable type, and must be assignable to the result of dereferencing .
Returns zero on success, or -EFAULT on error.
#define strlen_user | ( | str | ) | strnlen_user(str, ~0UL >> 1) |
strlen_user: - Get the size of a string in user space. : The string to measure.
Context: User context only. This function may sleep.
Get the size of a NUL-terminated string in user space.
Returns the size of the string INCLUDING the terminating NUL. On exception, returns 0.
If there is a limit on the length of a valid string, you may wish to consider using strnlen_user() instead.
#define USER_DS MAKE_MM_SEG(0xFFFFFFFF) |
__clear_user: - Zero a block of memory in user space, with less checking. : Destination address, in user space.
: Number of bytes to zero.
Zero a block of memory in user space. Caller must check the specified block with access_ok() before calling this function.
Returns number of bytes that could not be cleared. On success, this will be zero.
Definition at line 158 of file uaccess_with_memcpy.c.
Definition at line 24 of file usercopy.c.
Definition at line 15 of file usercopy.c.
Definition at line 113 of file usercopy.c.
clear_user: - Zero a block of memory in user space. : Destination address, in user space.
: Number of bytes to zero.
Zero a block of memory in user space. Caller must check the specified block with access_ok() before calling this function.
Returns number of bytes that could not be cleared. On success, this will be zero.
clear_user: - Zero a block of memory in user space. : Destination address, in user space.
: Number of bytes to zero.
Zero a block of memory in user space.
Returns number of bytes that could not be cleared. On success, this will be zero.
Definition at line 224 of file usercopy.c.
strncpy_from_user: - Copy a NUL terminated string from userspace. : Destination address, in kernel space. This buffer must be at least bytes long. : Source address, in user space. : Maximum number of bytes to copy, including the trailing NUL.
Copies a NUL-terminated string from userspace to kernel space.
On success, returns the length of the string (not including the trailing NUL).
If access to userspace fails, returns -EFAULT (some data may have been copied).
If is smaller than the length of the string, copies bytes and returns .
strnlen_user: - Get the size of a user string INCLUDING final NUL. : The string to measure. : Maximum count (including NUL character)
Context: User context only. This function may sleep.
Get the size of a NUL-terminated string in user space.
Returns the size of the string INCLUDING the terminating NUL. If the string is too long, returns 'count+1'. On exception (or invalid count), returns 0.