On Mon, Feb 11, 2008 at 10:12:41AM -0500, James Carlson wrote:
> prasad writes:
> >     this->text = *(char *)copyin(self->bufp,self->size);
> 
> That line copies in the buffer, and then dereferences the first byte.
> The contents of this->text is a single byte.  That's probably not what
> you want.  I'd suggest:
> 
>     this->text = (char *)copyin(self->bufp,self->size);

Another option is to use the two parameter version of the copyinstr()
subroutine:

        this->text = copyinstr(self->bufp, self->size);

I've updated the DTrace documentation to include information on this:

http://wikis.sun.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-{{copyinstr}}

And I've updated the chapter on User Process Tracing to include an example:

http://wikis.sun.com/display/DTrace/User+Process+Tracing#UserProcessTracing-{{copyin}}and{{copyinstr}}Subroutines

Adam

-- 
Adam Leventhal, Fishworks                        http://blogs.sun.com/ahl
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to