This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]