On Wed, 13 Mar 2002, Xiaoning He wrote:
| I am trying to modify the kernel. I need some memory operations
| including memset, memcpy, malloc etc.
|
| I was told that these functions are not available in the kernel
| namespace, and I have to use some different functions like kmalloc()
| etc. However, I can not find the information about how to use these
| functions.
What kernel version and what CPU type?
These can affect the answer.
For 2.4.x (looking at 2.4.17):
kmalloc() and kfree() function prototypes are in
linux/include/linux/slab.h .
Depending on cpu_type, memset() and memcpy() might or
might not be inline functions. Their function prototypes
and/or inlines are in
linux/include/asm-<cpu_type>/string.h .
| Could you please let me know where I can find the information about how
| to use these functions?
If you have the necessary DocBook tools (or are willing
to install them), you can do
make psdocs pdfdocs htmldocs # any or all of these
to create kernel doc. files in
linux/Documentation/DocBook/*, then look at kernel-api.*
for kernel API information.
Or you could get Linux Device Drivers (second edition)
in paper form or find it on the web (free :) at
http://www.xml.com/ldd/chapter/book/index.html
--
~Randy
|