Is it possible to get a pointer to process descriptor of a process in a kernel module?If it is possible pls post how? I need to find all files opened by a process and their offset values of each file descriptor....
Well, I don't know about how to get that from a kernel module, but there are plenty of ways to get it from a regular piece of code... Not particularly efficient ones, that is. Starting at the way lsof and other similar utilities do it, and going on with a look at /proc/$pid/fd
Scan the proc file system looking for processes with open file descriptors. You cannot, however, detect offsets into open file handles.
I found it I got the pointer to process Descriptor... the function is declared in linux/sched.h
struct task_struct find_task_by_pid(pid_t pid)
.. I think I can use this process descriptor to follow to the file descriptor and their offsets...Thank u all for ur support
I'm not sure what you are trying to achieve, usually everything only executes in the context of a given process id. That is always available to you via the "current" global. If you want to find an arbitrary process descriptor then find_task_by_pid is probably what you want. All process information flows from task_struct.
Check this article I wrote some time back: http://lg.cybermirror.org/133/saha.html. Its on Linux processes and their representation in the Kernel- for newbies.