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]

Re: tcp.setsockopt probe seems to be returning incorrect optval


On 03/25/2010 09:48 AM, MacCana, Mike wrote:
> Hi SystemTap folks,
> 
> I have a simple stap I'm documenting (see
> http://sourceware.org/systemtap/wiki/WSTCPSocketOptions
> <http://sourceware.org/systemtap/wiki/WSTCPSocketOptions> ) to find apps
> that use the TCP_NODELAY option on their sockets.
> 
> When I run:
> 
> probe tcp.setsockopt
> {
> printf (" App '%s' (PID %d) set socket option %s with value %d ...",
> execname(), pid(), optstr, optval) }
> 
> I always get the result:
> 
> App 'python2.4' (PID 29279) set socket option TCP_NODELAY with value 0
> ...success 
> 
> When when my app is setting the value to true, not false: 
> 
> mysocket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
> 
> So optval doesn't seem to be the value I understand it is from the docs
> - does anyone have any ideas why, or how I can get my stap to report the
> correct value ?

Since the tcp.setsockopt probe doesn't provide an 'optval', it defaults
to 0.  That's why it always looks false.

You can print the value of $optval, but that's an user address, not a
value.  Assuming you only want to support options that have integer
values, this should work:

probe tcp.setsockopt
{
  printf (" App '%s' (PID %d) set socket option %s with value %d ...",
    execname(), pid(), optstr, user_int($optval))
}

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


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