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

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



-----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-----

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ