ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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...
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..
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.