How to get list of opened files in linux kernel programming?
in linux kernel programming, i want to get the path/get the files opened by a process.
i know i should look into files_struct, but i can't figure it out. basically, what i want is a correspondent for "ps aux | grep <pid>" any thoughts on how i should go about this? any help is appreciated. 10x |
Get your pid with the ps command above then use this command:
Code:
lsof -p pid ---------- Post added 05-04-12 at 12:35 PM ---------- On a side note you can add the 'ww' options to your ps command in addition to your aux options to see their command line options which usually include file paths, however it won't show you all open files. |
i actually am trying to get that in C programming.
the research i've done, points me to task_struct and files_struct, but i haven't actually seen an example of how it.s done. 10x |
See if this helps
http://tuxthink.blogspot.in/2012/05/...f-process.html |
@bsat
yes, that's exactly what i.m looking for. thanks a lot, you are a life saver :) |
All times are GMT -5. The time now is 03:54 AM. |