Howdy, Does anyone happen to know if there is a way to tell if a file descriptor passed to a read() or write() is associated with a socket? I have been parsing through the DTraceToolkit, /usr/demo/dtrace and the users guide, and can''t seem to locate an example. :( Any thoughts or suggestions? Thanks, - Ryan -- UNIX Administrator http://daemons.net/~matty
On Tue, Nov 01, 2005 at 08:30:38PM -0500, Matty wrote:> > Howdy, > > Does anyone happen to know if there is a way to tell if a file descriptor > passed to a read() or write() is associated with a socket? I have been > parsing through the DTraceToolkit, /usr/demo/dtrace and the users guide, > and can''t seem to locate an example. :( Any thoughts or suggestions?% dtrace -n '' syscall::read:entry /fds[arg0].fi_fs == "sockfs"/ {@a[execname] = count()} '' dtrace: description ''syscall::read:entry'' matched 1 probes ^C xwrits 4 xterm 52 fvwm2 258 Xsun 276 % Note that this catches any kind of socket. (Unix domain, etc.) Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
On 11/1/05, Matty <matty91 at gmail.com> wrote:> > Howdy, > > Does anyone happen to know if there is a way to tell if a file descriptor > passed to a read() or write() is associated with a socket? I have been > parsing through the DTraceToolkit, /usr/demo/dtrace and the users guide, > and can''t seem to locate an example. :( Any thoughts or suggestions? >I wrote a dtrace script that tracks reads/writes over sockets, perhaps it can be of help, http://uadmin.blogspot.com/2005/01/second-dtrace-script.html, it uses functions that read/write call, there is no easy way to this based on the read/write calls. This was the best solution I could find to do this. James Dickens uadmin.blogpsot.com> Thanks, > - Ryan > > -- > UNIX Administrator > http://daemons.net/~matty > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
On Tue, 1 Nov 2005, Jonathan Adams wrote:> On Tue, Nov 01, 2005 at 08:30:38PM -0500, Matty wrote: >> >> Howdy, >> >> Does anyone happen to know if there is a way to tell if a file descriptor >> passed to a read() or write() is associated with a socket? I have been >> parsing through the DTraceToolkit, /usr/demo/dtrace and the users guide, >> and can''t seem to locate an example. :( Any thoughts or suggestions? > > % dtrace -n '' > syscall::read:entry > /fds[arg0].fi_fs == "sockfs"/ > {@a[execname] = count()} > '' > dtrace: description ''syscall::read:entry'' matched 1 probes > ^C > > xwrits 4 > xterm 52 > fvwm2 258 > Xsun 276 > % > > Note that this catches any kind of socket. (Unix domain, etc.) > > Cheers, > - jonathanThanks Jonathon! Any way to get soemthing like this added to the the users guide or /usr/demo/dtrace? Hope you are having a nice evening, - Ryan -- UNIX Administrator http://daemons.net/~matty
On Tue, 1 Nov 2005, James Dickens wrote:> On 11/1/05, Matty <matty91 at gmail.com> wrote: >> >> Howdy, >> >> Does anyone happen to know if there is a way to tell if a file descriptor >> passed to a read() or write() is associated with a socket? I have been >> parsing through the DTraceToolkit, /usr/demo/dtrace and the users guide, >> and can''t seem to locate an example. :( Any thoughts or suggestions? >> > I wrote a dtrace script that tracks reads/writes over sockets, perhaps > it can be of help, > http://uadmin.blogspot.com/2005/01/second-dtrace-script.html, it uses > functions that read/write call, there is no easy way to this based on > the read/write calls. This was the best solution I could find to do > this.Very cool! Thanks James! - Ryan -- UNIX Administrator http://daemons.net/~matty