LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-23-2007, 05:56 AM   #1
gomathisankar
LQ Newbie
 
Registered: Mar 2007
Posts: 7

Rep: Reputation: 0
Share memory between Kernel and user


Hi

I want to make a common memory space between user and Kernel. I need to send each packet to a particular place from my network driver to a memory. And One of the application will take that and will do some process.Is there any way to share a common space between user and kernel. Thanks in advance for your help

Thanks & Regards
Gomathisankar.P
 
Old 05-24-2007, 03:53 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You should do this using one of the standard mechanisms. Iptables module is one solution, you can also think about extra /proc or /dev file by your driver, depending on what you want to do with the packet after it is processed.
 
Old 05-25-2007, 01:46 AM   #3
asprakash
Member
 
Registered: May 2006
Location: Chennai, India
Posts: 74
Blog Entries: 3

Rep: Reputation: 18
My suggestion is, using shared memory you can do this. Cretae an shared memory device in /dev, send ur data from ur driver to that share memory. Ur Application can access those spaces as a device, like "/dev/shm".
 
Old 05-25-2007, 07:17 AM   #4
gomathisankar
LQ Newbie
 
Registered: Mar 2007
Posts: 7

Original Poster
Rep: Reputation: 0
How to do that

Hi

Thanks for your reply. Can you guide me how to do that.

Thanks & regards
Gomathisankar.P
 
Old 05-26-2007, 05:59 AM   #5
asprakash
Member
 
Registered: May 2006
Location: Chennai, India
Posts: 74
Blog Entries: 3

Rep: Reputation: 18
Sure. I have implemented this concept in RTLinux and Linux.
What type of help you want.
The ceoncept is simple,Create a shared memory device from kernel. Write your data here.Read the same data by application program.
Any other info you need.
 
Old 05-28-2007, 01:33 AM   #6
gomathisankar
LQ Newbie
 
Registered: Mar 2007
Posts: 7

Original Poster
Rep: Reputation: 0
How to access it from kernel

Thank you very much Prakash.I understood your thought.But how to access the device from the Kernel(i mean to say from my driver). From the application you can access using open the dev,read and write . But how it is possible from the driver .


Thanks & Regards

Gomathisankar.P
 
Old 05-29-2007, 01:16 AM   #7
asprakash
Member
 
Registered: May 2006
Location: Chennai, India
Posts: 74
Blog Entries: 3

Rep: Reputation: 18
Then my logic is not suitable for you.I used IPC to shared the data b/w the processes.Ur case is diffi. You just ignore the above and go to the following link.Hope it will helpful for you.
I dont have more idea abt it, but APMK, we can share the data from kernel to user land by the following ways, relayfs, procfs, debugfs, ioctls, mmap....

http://www.linuxjournal.com/article/1287
http://www.linuxjournal.com/article/1312
 
Old 05-31-2007, 01:55 AM   #8
gomathisankar
LQ Newbie
 
Registered: Mar 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Better to use Netlink

Hi

Seems netlink is a good technique ofr these kind of application.But i am not able to find any Good working program in Linux kernle 2.6 . Anybodies please help me
Thanks & regards
Gomathisankar
 
  


Reply

Tags
user, username



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
How to share data b/w user space and kernel space nandac Linux - Kernel 1 11-28-2006 10:15 PM
Share CPU resources and memory? corbintechboy General 3 03-17-2006 04:36 AM
IPC Memory Share - C Program - Why not exiting for(;;) ?? brunnopessoa Programming 4 09-05-2004 09:27 PM
Allocating memory for user program variable from kernel module appas Programming 2 08-12-2004 10:52 PM
Standard Way To Share Memory Among Processes? Sys-V IPC? overbored Programming 1 06-21-2003 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:35 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