Furrball
asked on
How to access data in an existing file form a kernel module
Hi, I'm a newbie in programming and especially in Linux. I'm trying to write a LKM and to get it to do what I want, I need information from files in /proc. To be more precise, I need info from the 'status' file in the /proc/pid where pid is the PID of the process I need the info for. In other words, the file I need info from is constantly different.
I checked the Linux Kernel Module Programming Guide already but that has examples of using a static file in /proc that you created in the module.
Does anybody know how this can best be done, and have some (simple) examples? Like I said, I'm fairly new to C and kernel programming so the simpler the example, the better :-)
If it is not possible, some examples on how to input/output data between a user and kernelspace program through /proc in Linux 2.4 are also very appreciated.
I'm using RedHat 7.3 with a 2.4.20 kernel by the way.
I checked the Linux Kernel Module Programming Guide already but that has examples of using a static file in /proc that you created in the module.
Does anybody know how this can best be done, and have some (simple) examples? Like I said, I'm fairly new to C and kernel programming so the simpler the example, the better :-)
If it is not possible, some examples on how to input/output data between a user and kernelspace program through /proc in Linux 2.4 are also very appreciated.
I'm using RedHat 7.3 with a 2.4.20 kernel by the way.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: bryanh {http:#8031139}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jmcg
EE Cleanup Volunteer