public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Problem with 32-bit negative return values
@ 2006-10-07 21:23 Mike Mason
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Mason @ 2006-10-07 21:23 UTC (permalink / raw)
  To: SystemTAP

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-10 20:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <452BD98F.8050602@us.ibm.com>
2006-10-10 17:52 ` Problem with 32-bit negative return values Frank Ch. Eigler
2006-10-10 18:28   ` Roland McGrath
2006-10-10 20:25     ` Frank Ch. Eigler
2006-10-10 20:41   ` Mike Mason
2006-10-07 21:23 Mike Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).