Re: Getting fd list of all processes in the system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2006-12-17 at 15:17 +0900, Seongsu Lee wrote:
> Hello,
> 
> I want to get the information of fd (file descriptor)
> of all the processes in the system. I mean that the
> list of file names which is currently opened by a 
> process is needed.
> 
> I think I can get it by checking the /proc/<PID>/fd 
> directory in the user level. But what I want is 
> to get it in kernel level (kernel module)
> 
> I think there must some data structures that keep
> the list of working processes in the system and also
> data strcutures that keep file descriptors which is
> currently opened and pointing a file.
> 
> Please help me if you know something. Thank you
> verh much.

You can see how the code in /proc does it, but I think you want to look
at struct task_struct.  This is a per-process struct that has a lot of
state information.  Inside it there is struct files_struct *files, which
contains the open file information.

Avishay


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux