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: [PATCH] - DRAFT - Easy access to IP address in struct sockaddr in syscall.bind probe (for now)


Hi, Robin -

rhack wrote:

> [...]  Then I decided to write this patch. Patch is only draft now
> and comments are very welcome.

Nice.  A few code comments:

The use of TMP_STAP_RETVALUE / MAXLEN in the embedded-c function is a
little clumsy.  Have you considered using ordinarily named variables
to track the remainder base/length of STAP_RETVALUE, and doing the
RETVALUE_INC_SKIP dance inlined instead of as a macro?  What about
delimiters between the data corresponding to multiple SA_* selections?


> Very easy example are attached too.

It might be even simpler if the related tapset functions all get this
kind of stuff, but perhaps plopped into a macro for easier handling:

probe syscall.bind = ... {
%( systemtap_v >= "2.5" %? 
    if (_struct_sockaddr_u_sa_family(my_addr_uaddr, addrlen) =~ "AF_INET.*") {
       uaddr_ip = _struct_sockaddr_u_ip_addr(my_addr_uaddr, addrlen)
       uaddr_ip_port = ... 
    }
%)

where the whole %(  %)  block could be @defined in a macro, kind of like
_nfs_data_timestamp in tapset/linux/nfs_proc.stpm.


> What is not solved in this patch:
>     * Error handling if wrong struct is passed - now it's just return empty ("") string. Maybe throw exception will be better.
>     * Expansion to syscall.connect probe.
>     * Write tapset shell for new internal functions.

Yup, plus a test case (e.g., a testsuite/buildok file).

Thanks!

- FChE


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