Hi Adam,
I found the same issue while playing with example scripts from "Solaris Internals" chapter on DTrace.
There is example script showing how to use return value from the syscall.
The point is that it works fine on 64-bit kernels and works incorrectly on 32-bit kernels. That is, negative 32-bit return values are not sign-extended as appropriate into 64-bit signed integer so for -1 you get 4294967295 as a result and comparison to -1 fails (but comparison of (2^64)-1 to -1 works fine meaning these values are considered equal). In case of two 32-bit return values they are combined in a single 64-bit value which one needs to split into parts to get meaningful results.
For me this is a bug unless it is documented somewhere as a feature.
Please correct me if I misunderstand something.
Victor
> Hi Peter,
>
> The argN variables are always unsigned 64-bit
> quantities. Ideally arg[0]
> would be a signed 32-bit integer in the case you
> describe, but we don't
> have types for syscall provider probes.
>
> Adam
>
> On Tue, Jul 18, 2006 at 10:59:32PM +0800, Peter
> Karlsson wrote:
> > Hi,
> >
> > Quickie, I hope. Shouldn't arg0 be a signed int??
> From what I can see
> > running this quick line to check for failed
> syscalls, it looks like it's
> > an unsigned int??
> >
> > bash-3.00# dtrace -n 'syscall:::return /arg0 == -1/
> {@[probefunc] =
> > count();}'
> > dtrace: description 'syscall:::return ' matched 227
> probes
> > ^C
> >
> > Which is a bit strange, I should have some failed
> syscalls. So if I add
> > a type cast for arg0 to int:
> > bash-3.00# dtrace -n 'syscall:::return /(int)arg0
> == -1/ {@[probefunc] =
> > count();}'
> > dtrace: description 'syscall:::return ' matched 227
> probes
> > ^C
> >
> > lwp_cond_wait
> 2
> 31
>
> 4
> > lwp_park
>
> 4
> > ioctl
>
> 27
> > read
>
> 80
> >
> > Now it looks more like what I expected. So it looks
> like arg0 in this
> > case is an unsigned int.
> >
> > bash-3.00# more /etc/release
> > Solaris Nevada snv_42
> X86
> > Copyright 2006 Sun Microsystems, Inc.
> All Rights Reserved.
> Use is subject to license
> terms.
> Assembled 12 June 2006
> ue to my network card.
> >
> > Cheers,
> > Peter
> >
> > --
> > OpenSolaris: Innovation Matters
> <http://www.opensolaris.org> *Peter
> > Karlsson *
> > *Solaris Technology Evangelist*
> > *Sun Microsystems*
> > Phone: +65 62392 625 / x58625
> > Mobile:+65 9061 7764
> > Email: Peter.Karlsson at Sun.COM
> >
> > _______________________________________________
> > dtrace-discuss mailing list
> > dtrace-discuss at opensolaris.org
>
> --
> Adam Leventhal, Solaris Kernel Development
> http://blogs.sun.com/ahl
> _________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
>
This message posted from opensolaris.org