Linux Kernel
3.7.1
|
#include <linux/errno.h>
#include <linux/thread_info.h>
#include <linux/prefetch.h>
#include <linux/string.h>
#include <asm/page.h>
Go to the source code of this file.
Data Structures | |
struct | exception_table_entry |
struct | __large_struct |
Functions | |
unsigned long | search_exception_table (unsigned long) |
void | sort_exception_table (void) |
long | __put_user_bad (void) |
long | __get_user_bad (void) |
unsigned long __must_check | __copy_tofrom_user (void *to, const void *from, unsigned long size) |
unsigned long | __clear_user (void *addr, unsigned long size) |
long | strncpy_from_user (char *dest, const char __user *src, long count) |
__must_check long | strlen_user (const char __user *str) |
__must_check long | strnlen_user (const char __user *str, long n) |
#define __copy_from_user | ( | to, | |
from, | |||
size | |||
) | __copy_tofrom_user(to, from, size) |
#define __copy_from_user_inatomic __copy_from_user |
#define __copy_to_user | ( | to, | |
from, | |||
size | |||
) | __copy_tofrom_user(to, from, size) |
#define __copy_to_user_inatomic __copy_to_user |
#define __get_user | ( | x, | |
ptr | |||
) | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
#define get_fs | ( | void | ) | (current_thread_info()->addr_limit) |
#define set_fs | ( | x | ) | (current_thread_info()->addr_limit = (x)) |
#define user_addr_max | ( | ) | (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) |
Definition at line 116 of file usercopy.c.
__must_check long strlen_user | ( | const char __user * | str | ) |
strlen_user: - Get the size of a user string INCLUDING final NUL. : 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.
Definition at line 126 of file strnlen_user.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.