httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: [off topic] number of open file descriptors.
Date Tue, 23 Nov 1999 12:50:54 GMT

In article <3833B8B0.7E38C038@ix.netcom.com> you wrote:

> Sorry for the off topic question. However I thought that some folks on
> this board may have worked on this issue.
> 
> On Unix, how can I get the number of open file descriptors that the process
> has opened ? I can find out what is the maximum that it CAN open by issuing
> a getrlimit() function call, but that is not what I am looking for.

For debugging purposes I can recommend you to use "lsof"
(ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/). It can display the amount of
opened filedescriptors and even gives you the concrete list, i.e. which fd is
attached to what. I sometimes even run "lsof -p <pid>" via system(3) from
within the process (<pid> is the result of a getpid(2) there). If you need
this information in a portable way for NON-debugging purposes it gets hard.
AFAIK there is no way to really determine this info from within the process
through any portable functions. 
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message