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 ..


-----Original Message-----
From: angelo.rajadu...@sun.com [mailto:angelo.rajadu...@sun.com] 
Sent: Tuesday, August 18, 2009 4:37 PM
To: Cherukupalli, Venkateshu
Cc: dtrace-discuss@opensolaris.org
Subject: Re: [dtrace-discuss] Convert fd into string

Not sure what you mean by FD as a string. If you are trying to print the
name of the file from the FD them you can use the fds[] array.

Something like

syscall::read:entry
    /pid == $1 /
    {
        printf("Reading (%s) \n", fds[arg0].fi_pathname);

    }

-Angelo

On Aug 18, 2009, at 4:27 PM, venkateshu.cherukupa...@ubs.com wrote:

>
> Hi,
>
> I am trying to convert and print fd from read/write calls into string 
> and it fails with below error.
>
> dtrace: error on enabled probe ID 1 (ID 23: syscall::read:entry):
> invalid address (0x0) in action #1
>
> What am I missing ?
>
>    syscall::read:entry
>    /pid == $1 /
>    {
>        printf("Reading FD (%s) \n", (string)arg0);
>
>    }
>
> Printing fd as integer (%d) works ok.
>
> Cheers,
> Venkat
> 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

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

Reply via email to