How to use memcpy in kernel driver

Kristof Provost kristof at sigsegv.be
Mon Jan 27 15:28:17 EST 2014


On 2014-01-27 11:53:00 (-0800), m silverstri <michael.j.silverstri at gmail.com> wrote:
> How can I use memcoyp in memcpy?
> I try #include stdio.h and string.h, but .h fails to include during compilation.
> 
That's because stdio.h is a C library header. You can't use the C
library in the kernel.

You should actually be able to include string.h, but you need the kernel
version, which lives in include/linux/string.h.
The kernel provides a few of the functions usually provided by the C
library. Things like memcpy() and memset() exist. printf() doesn't, but
there is an sprintf(), ...

Kristof



More information about the Kernelnewbies mailing list