This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] - DRAFT - Easy access to IP address in struct sockaddr in syscall.bind probe (for now)
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Robin Hack <rhack at redhat dot com>
- Cc: systemtap at sourceware dot org
- Date: Wed, 13 Nov 2013 17:18:35 -0500
- Subject: Re: [PATCH] - DRAFT - Easy access to IP address in struct sockaddr in syscall.bind probe (for now)
- Authentication-results: sourceware.org; auth=none
- References: <20131113144651 dot GI7014 at bigoook dot brq dot redhat dot com>
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