public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Mike Mason <mmlnx@us.ibm.com>
To: SystemTAP <systemtap@sources.redhat.com>
Subject: Problem with 32-bit negative return values
Date: Sat, 07 Oct 2006 21:23:00 -0000	[thread overview]
Message-ID: <45281A9E.1050207@us.ibm.com> (raw)

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

             reply	other threads:[~2006-10-07 21:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-07 21:23 Mike Mason [this message]
     [not found] <452BD98F.8050602@us.ibm.com>
2006-10-10 17:52 ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45281A9E.1050207@us.ibm.com \
    --to=mmlnx@us.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).