Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I find out how many file descriptors currently used in a process ?

Status
Not open for further replies.

bamore

Programmer
Dec 22, 2003
11
US
In my application of the process is getting out of file descriptors( MAX is configured as 64 ).
Is there any way i can call some function(s) in a C program to find out number of file descriptors currently used in a process?
Thanks.
 
Hi bomberman,
Thanks for your response however i did not see anything in this link about how can we see total number of FDs currently used by a process?
Anyway i found out at least one way: using lsof utility we can find out about the FDs currently used by a process!
 
you can try pfiles <pid> | wc -l or ls /proc/<proc>/fd | wc -l to get an estimate.

 
Sorry I meant ls /proc/<pid>/fd | wc -l
If you have lsof, you can do a lsof | wc -l too.

King Tan
Attachmate Corp.
SCNA,SCSA,HP-UX SCA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top