LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Problem using kmalloc (https://www.linuxquestions.org/questions/linux-kernel-70/problem-using-kmalloc-946199/)

suduko 05-21-2012 03:25 PM

Problem using kmalloc
 
#include<linux/slab.h>
main()
{
int *p;
p = kmalloc(sizeof(int)*10);

}

I am trying to use the basic program , but it is saying that linux/slab.h: No such file or directory .. I tried locating linux/slab.h manually but still it is not compiling . I would really appreciate someone if you could help me using kmalloc successfully.

pan64 05-22-2012 04:38 AM

have you found this slab.h?
maybe this helps: http://www.linuxforums.org/forum/ubu...ce-driver.html

bsat 05-22-2012 12:20 PM

How are you compiling the module , can you show the makefile.

emntech 05-24-2012 04:31 AM

What are you trying to do?. kmalloc is not a userspace function, you need to use this for kernel programs. no main() function in kernel.


All times are GMT -5. The time now is 04:40 PM.