Re: How to find the list and number of processes opened by a process?

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

 



Ya, I know that all this information is already available in the /proc/<pid>/stat and fd/ files.
I am new to the linux kernel programming and trying to write some small module programs and understand the working of linux kernel. Hence, was trying to reinvent the wheel but got confused.

Can you please provide some help....

Thanks and Regards,
Prasad.

On 3/5/07, Erik Mouw < mouw@xxxxxxxxxxxx> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Mar 05, 2007 at 05:55:23PM +0530, Prasad Joshi wrote:
> I am trying to get some process stats like command name, pid, ppid, state,
> number of files opened stc. And printing it through a proc entry. I am not
> sure how could I find number of files opened by a process. I went through
> some docs they mentioned about

No need to reinvent the wheel, all information is already there.
/proc/<pid>/state tells you about PID, PPID, and state.

> fdtable, fd_set, fd_array but, got confused with them.

Number of open files can be figured out by counting the number of
entries in /proc/<pid>/fd/


Erik

- --
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF7BCc/PlVHJtIto0RAiEuAJ9aLRXAoUbj1aCvTajuJylCm2EDxgCgjn3S
iCqG00Bk5eM7qVv3OLU9hqM=
=OhpL
-----END PGP SIGNATURE-----


[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