LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2005, 08:54 AM   #1
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Rep: Reputation: 15
LKM - Read Config


Hey, I want a Loadable Kernel Module to be able to get some configuration from a text file. The problem is that LKMs cannot use fopen, fprintf, fscanf etc. So is there alternatives that I can use. Also can an LKM get data from a Shared Memory, so that I can make a program to parse the config file and adds this data in a structure in some Shmem for the LKM to read.
Thanks a lot
 
Old 02-10-2005, 06:12 PM   #2
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Original Poster
Rep: Reputation: 15
Any replies !?
 
Old 02-11-2005, 12:21 AM   #3
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
you could use a proc entry to have this functionality ...this way you'll be able to share data...and do whatever you want to..
also there is a concept of intermodule communication...if you want you can use that too...
 
Old 02-11-2005, 07:33 AM   #4
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Original Poster
Rep: Reputation: 15
Hi Shishir
Thank you, so what do people in real life actually do? Do you know any examples?
 
Old 02-11-2005, 07:51 AM   #5
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
most of the time...at least that is what i used..proc entry is easy to implement and to use to...that is not to say that intermodule communication is rocket science...but cos i have never used it..cant really vouch for it...sorry if this answer is too skewed towards proc..

 
Old 02-11-2005, 09:09 AM   #6
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Original Poster
Rep: Reputation: 15
Hey,
I also heard about using NetLink or even Simple Sockets to communicate between user and kernel spaces. Hoever I have no clue of the implementation.
Any ways, thank you for your advice, and I'll try to inform you of what I'll do whenever it is done.
Also if any one have more advices or more ideas and real world implementations. please tell me.
 
Old 02-11-2005, 09:35 AM   #7
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
netlink spcklets are used to exchange routing information between the user space and the kernel space..
you can use it to exchange the routing information between the user space and kernel space...but i thot you wanted two kernel modules ..in that case you can use ioctl also .if it a user space kernel space communication...
yopu can create a character device and pass the info you want from the kernel using copy to user and copyfromuser...
-shishir
 
Old 02-22-2005, 04:27 AM   #8
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Rep: Reputation: 30
hi can give a very simple LKM example to read/write proc fs?

have a hard time getting the example on other tutorial to work.
 
Old 02-22-2005, 04:54 AM   #9
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Original Poster
Rep: Reputation: 15
See this link, and looking for your feedback
http://www.geocities.com/gr33ndata/articles/proc.txt
 
  


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
Newb wants to know how to read the config.log diletone Mandriva 4 11-08-2005 07:10 AM
read options from config file biiiep Programming 4 05-05-2005 03:30 AM
How does linux read config files? Thaidog Linux - Newbie 13 05-31-2004 12:14 PM
Standard way to read config files? nmoog Programming 4 01-19-2004 11:17 AM
Unable to read config file............ FXRS Linux - Software 7 07-03-2003 08:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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