LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-21-2012, 03:25 PM   #1
suduko
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
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.
 
Old 05-22-2012, 04:38 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
have you found this slab.h?
maybe this helps: http://www.linuxforums.org/forum/ubu...ce-driver.html
 
Old 05-22-2012, 12:20 PM   #3
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
How are you compiling the module , can you show the makefile.
 
Old 05-24-2012, 04:31 AM   #4
emntech
LQ Newbie
 
Registered: May 2012
Posts: 8

Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kmalloc and no data caching smartanwar80 Linux - Kernel 1 02-09-2011 03:34 AM
kmalloc onto an aligned border timboar Linux - Embedded & Single-board computer 5 10-30-2010 09:36 AM
Can not find header files to use kmalloc() yousafsajjad Programming 23 06-29-2010 11:12 PM
kmalloc returning overlapped address dipakn Linux - General 4 10-29-2003 11:29 PM
Kmalloc returns null iannou Linux - General 0 06-28-2003 10:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration