How to access data in an existing file form a kernel module
Posted on 2003-02-25
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.