In C this would be done (non-standard) with "itoa", or in a more standard way 
using sprintf, neither of which exist in "D".

Chip

> -----Original Message-----
> From: dtrace-discuss-boun...@opensolaris.org [mailto:dtrace-discuss-
> boun...@opensolaris.org] On Behalf Of Jonathan Adams
> Sent: Tuesday, August 18, 2009 5:54 PM
> To: venkateshu.cherukupa...@ubs.com
> Cc: dtrace-discuss@opensolaris.org
> Subject: Re: [dtrace-discuss] Convert fd into string
> 
> On Tue, Aug 18, 2009 at 06:16:50PM -0400,
> venkateshu.cherukupa...@ubs.com wrote:
> >
> > Yup, that will do. But, still I wonder why the typecast fails ?
> 
> Because the argument is an integer, not a pointer to a kernel string?
> 
> Typecasting in D is like typecasting in C: almost no work is done.
> Certainly no lookup of the file descriptor table is done.
> 
> Cheers,
> - jonathan
> 
> > -----Original Message-----
> > From: Chad Mynhier [mailto:cmynh...@gmail.com]
> > Sent: Tuesday, August 18, 2009 5:06 PM
> > To: Cherukupalli, Venkateshu
> > Cc: angelo.rajadu...@sun.com; dtrace-discuss@opensolaris.org
> > Subject: Re: [dtrace-discuss] Convert fd into string
> >
> > Why not just aggregate on the tuple <fd, file name>?  Something like
> this:
> >
> > syscall::read:entry
> > {
> >         @c[arg0, fds[arg0].fi_pathname] = count(); }
> >
> > If the output's unsatisfactory, you could always use a printa() in en
> END clause to get it into the format you want.
> >
> > Chad
> >
> > On Tue, Aug 18, 2009 at 4:51 PM, <venkateshu.cherukupa...@ubs.com>
> wrote:
> > >
> > > I just need to print the file descriptor number  as a string. I
> > > would like to join fd and file name into one string and then
> > > aggregate on reads/writes reason I want to do this is, for sockets
> > > fi_pathname just shows up as "unknown" - instead if I can get fd, I
> > > can do pfiles and get the socket details ..
> > >
> > >
> > Visit our website at http://www.ubs.com
> >
> > This message contains confidential information and is intended only
> > for the individual named.  If you are not the named addressee you
> > should not disseminate, distribute or copy this e-mail.  Please
> notify
> > the sender immediately by e-mail if you have received this e-mail by
> > mistake and delete this e-mail from your system.
> >
> > E-mails are not encrypted and cannot be guaranteed to be secure or
> > error-free as information could be intercepted, corrupted, lost,
> > destroyed, arrive late or incomplete, or contain viruses.  The sender
> > therefore does not accept liability for any errors or omissions in
> the
> > contents of this message which arise as a result of e-mail
> transmission.
> > If verification is required please request a hard-copy version.  This
> > message is provided for informational purposes and should not be
> > construed as a solicitation or offer to buy or sell any securities or
> > related financial instruments.
> >
> >
> > UBS reserves the right to retain all messages. Messages are protected
> > and accessed only in legally justified cases.
> > _______________________________________________
> > dtrace-discuss mailing list
> > dtrace-discuss@opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to