Quoting Dmitry V. Levin (2016-06-16 01:36:47) > On Wed, Jun 15, 2016 at 12:43:00PM +0000, Fabien Siron wrote: > > This commit introduces a general socket netlink parser which prints > > the header and a string for the remaining part of the buffer. It doesn't > > handle all the netlink flags and types because the parser needs more > > information. It will be done soon. > > > > * net.c (printsock): Return family. > > (do_msghdr): Call decode_netlink_iov(). > > (send, sendto, recv, recvfrom): Call printsockbuf(). > > * netlink.c: New file. > > (decode_netlink): New function. > > (_decode_netlink): New static function. > > (decode_iov_netlink): New function. > > * defs.h (decode_netlink, decode_netlink_iov, getfdproto): Add. > > (printsock): Change return type. > > * util.c (getfdproto): Remove the static keyword to the function. > > * Makefile.am (strace_SOURCES): Add netlink.c. > > * xlat/netlink_flags.in: New file. > > * xlat/netlink_types.in: New file. > > --- > > Makefile.am | 1 + > > defs.h | 5 ++- > > net.c | 55 ++++++++++++++++++++++++------- > > netlink.c | 90 > > +++++++++++++++++++++++++++++++++++++++++++++++++++ > > util.c | 2 +- > > xlat/netlink_flags.in | 6 ++++ > > xlat/netlink_types.in | 4 +++ > > 7 files changed, 149 insertions(+), 14 deletions(-) > > create mode 100644 netlink.c > > create mode 100644 xlat/netlink_flags.in > > create mode 100644 xlat/netlink_types.in > > > > diff --git a/Makefile.am b/Makefile.am > > index 77e0cc8..ab0e200 100644 > > --- a/Makefile.am > > +++ b/Makefile.am > > @@ -156,6 +156,7 @@ strace_SOURCES = \ > > mtd.c \ > > native_defs.h \ > > net.c \ > > + netlink.c \ > > numa.c \ > > open.c \ > > or1k_atomic.c \ > > diff --git a/defs.h b/defs.h > > index ab06921..ee35dab 100644 > > --- a/defs.h > > +++ b/defs.h > > +static void > > +printsockbuf(struct tcb *tcp, int fd, long addr, long addrlen) > > +{ > > + enum sock_proto proto; > > + if (show_fd_path > 1) > > + proto = getfdproto(tcp, fd); > > + else > > + proto = SOCK_PROTO_UNKNOWN; > > + > > + switch (proto) { > > There is a shorter alternative: > > switch (show_fd_path > 1 ? getfdproto(tcp, fd) : SOCK_PROTO_UNKNOWN) { >
As verbose must be used instead of show_fd_path, the following seems better: switch (verbose(tcp) ? getfdproto(tcp, fd) : SOCK_PROTO_UNKNOWN) { > > @@ -947,10 +975,11 @@ SYS_FUNC(recv) > > printfd(tcp, tcp->u_arg[0]); > > tprints(", "); > > } else { > > - if (syserror(tcp)) > > + if (syserror(tcp)) { > > What's this? > printsockbuf() must be called if there is no syserror. What's wrong with that? > > diff --git a/netlink.c b/netlink.c > > new file mode 100644 > > index 0000000..30116dd > > --- /dev/null > > +++ b/netlink.c > > +static bool > > +_decode_netlink(struct tcb *tcp, void *elem_buf, size_t elem_size, > > names starting with underscore are reserved and shouldn't be used. > Do you prefer something like "print_netlink_iov"? Regards, -- Fabien Siron ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381 _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel