[dtrace-discuss] Tracing FDs

Theo Schlossnagle
2010-12-30T02:10:58Z

pfiles `pgrep .`

(as root) will show all open file descriptors by all processes.  If
you are running out of open ports -- maybe "netstat -an" is what you
want.

On Wed, Dec 29, 2010 at 9:04 PM, Shanya Jones <shanya_jones at yahoo.com>
wrote:
> Hi :
>
> ?(Apology if this is too naive question.)
> ?Our system is running out of FDs frequently and I would like to trace
which process takes FDs and does not close it. ?One suspicion is that many DNS
connection are made to the system which are never closed.
> To do this I wrote simple dtrace script;
> ---
> syscall::open*:entry
> {
> ? ? ? ?printf("FD opened > %s[%d(pid),%d(tid)],
%-60s\t\t%Y\n",execname,pid,tid,copyinstr(arg0),walltimestamp);
> }
>
> syscall::open*:return
> {
> ? ? ? ?printf("FD closed <
%s[%d(pid),%d(tid)],errno=%d,arg=%d\n",execname,pid,
> tid,errno,arg0);
> }
> ---
> Q:
> - would this capture all of the FD traffic including DNS??
> - Is there any other way I can improve this script to achieve my
objectives? ?How do I aggregate total number of FDs taken by all process at one
given time?
> ?We are not looking for netstat or snoop solution.
>
> Thanks,
> ?-Shanya
>
>
>
>
>
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
>



--
Theo Schlossnagle