This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Problem with 32-bit negative return values
- From: Mike Mason <mmlnx at us dot ibm dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Sat, 07 Oct 2006 14:22:38 -0700
- Subject: Problem with 32-bit negative return values
I'm trying to use the return value from sock_recvmsg() to determine how
many bytes are received. It ignores negative return values (errors).
probe kernel.function("sock_recvmsg").return
{
p = pid()
execname[p] = execname()
user[p] = uid()
sk_pid[p] ++
sk_rx[p] <<< $return > 0 ? $return : 0
printf("RECV %d\n", $return)
}
On x86, the negative values are correctly interpreted and printed:
RECV 1368
RECV -11
RECV 1368
RECV -11
RECV 1368
RECV -11
RECV 1368
RECV -11
But on x86_64, the negative values are interpreted and printed as large
positive values:
RECV 1440
RECV 4294967285
RECV 1440
RECV 4294967285
RECV 1440
RECV 4294967285
This completely messes up the sk_rx aggregation. It looks like 32-bit
negative integers are not being correctly cast to 64-bit negative integers.
Is this a bug or am I doing something wrong?
- Mike