copy_[to/from]_user()
/
get_user()
/
put_user()
include/asm/uaccess.h[SLEEPS]
put_user()
and get_user()
are used to get and put single values (such as an int, char, or
long) from and to userspace. A pointer into userspace should
never be simply dereferenced: data should be copied using these
routines. Both return -EFAULT
or 0.
copy_to_user()
and
copy_from_user()
are more general: they copy
an arbitrary amount of data to and from userspace.
![]() | Unlike |
The functions may sleep implicitly. This should never be called outside user context (it makes no sense), with interrupts disabled, or a spinlock held.