-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James
Carlson
Sent: Tuesday, November 20, 2007 11:07 AM
To: Janice Chang
Cc: [email protected]
Subject: Re: [dtrace-discuss] How to dereference a pointer to a pointer

Janice Chang writes:
> If I set "this->vpp" to arg2 in an entry function to zfs_lookup(), I'd


Do you really mean "this" or do you mean "self?"  The latter is the
one that is tied to a thread and spans action blocks.  The former gets
discarded at the end of the current action (and wouldn't be useful for
saving data between function entry and return, for example).

> like to retrieve the value of one of the fields of *(this->vpp) in the

> return function.  Something like the below (but the syntax below is
not 
> right):
> 
>         printf("zfs_lookup: %d", (*((vnode_t **)this->vpp))->v_count);

Typically, when I assign a variable in dtrace, I cast it first, like
this:

fbt::foo:entry
{
        self->vpp = (vnode_t **)arg0;
}

fbt::foo:return
/self->vpp/
{
        printf("zfs_lookup: %d", (*self->vpp)->v_count);
        self->vpp = 0;
}

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
dtrace-discuss mailing list
[email protected]
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to