Can anyone please help me with getting the proper header files needed for the copy_from_user
method?
I found a few of the include headers I need, but my compiler keeps saying that they are not found. I am running CentOS on my machine. I have tried yum
installing various kernel-headers and devel packages but still no luck.
Is there a special segment I need to add in my gcc
command? Everything I find on the Internet only tells me how to use the method but not actually how I can get access to it in the first place.
Defined in 2 files as a function: include/linux/uaccess. h, line 149 (as a function) tools/virtio/linux/uaccess.
The copy_to_user function copies a block of data from the kernel into user space. This function accepts a pointer to a user space buffer, a pointer to a kernel buffer, and a length defined in bytes. The function returns zero on success or non-zero to indicate the number of bytes that weren't transferred.
I assume you're developing a kernel module, because outside of it trying to use copy_from_user
wouldn't make sense. Either way, in the kernel use:
#include <linux/uaccess.h>
Edit: if building a kernel module is what you want, you may want to look at this Hello World Linux Kernel Module. Specifically the makefile portion may be of interest to you (search for obj-m
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With