LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 10-11-2005, 03:49 AM   #1
arunachalam
Member
 
Registered: Sep 2005
Posts: 53

Rep: Reputation: 15
Allocating Memory in the kernel


Hi,
 
Old 10-11-2005, 09:41 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
Ummm, what do you you want to know?

BTW... kmalloc is the method for allocating memory in the kernel.
 
Old 10-12-2005, 12:23 AM   #3
arunachalam
Member
 
Registered: Sep 2005
Posts: 53

Original Poster
Rep: Reputation: 15
Ya,
But allocating it in the kernel, and giving it to the user space (getting through pointers), I am unable to access the memory. I triesd with GFP_KERNEL & GFP_USER.

Can I use variable length array concept for pointers in the structures and giving it to the user space.
 
Old 10-12-2005, 07:49 AM   #4
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
I'll have to dive into one of the kernel books for this one... but I imagine it would be easier to allocate the space in user space in pass it into the kernel via an ioctl or read call to a module in order to have the kernel populate it. As far as I know, you can't kmalloc space and pass it to a userspace process in any straight forward fashion.
 
Old 10-12-2005, 09:51 AM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
I'm puzzled by this requirement. You can allocate shared-memory segments that processes may share among themselves. The kernel can, if it consents to do so, access anything. (So you could carve out the memory, and ask the kernel to do something with it.) But for memory in kernel space to be accessible by user processes is pretty a no-no. The closest thing that comes to that sort of thing is probably the mechanisms used by, for example, the /proc pseudo-filesystem. The mechanisms that are used to talk to things like the module auto-loader daemon (a privileged process in userland) are other examples.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
seg. fault when allocating memory via a pointer inside a struct elmafiacs Programming 4 02-20-2005 08:26 AM
Allocating memory for user program variable from kernel module appas Programming 2 08-12-2004 11:52 PM
allocating memory eshwar_ind Programming 6 02-26-2004 08:06 AM
Allocating bandwidth to applications ilikejam Linux - Networking 2 10-13-2003 06:04 AM
allocating space for new partition ranger12002 Linux - General 12 07-20-2003 04:07 PM


All times are GMT -5. The time now is 07:38 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration