[PATCH v7 2/4] Add a general netlink socket parser

Dmitry V. Levin ldv at altlinux.org
Wed Jun 22 16:55:40 UTC 2016

On Wed, Jun 22, 2016 at 01:27:04PM +0000, Fabien Siron wrote:
> Introduce 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.

Please format this paragraph.

> * net.c (printsock): Return family.

Change return type to int.
Return socket family on success and -1 in case of an error.

> (do_msghdr): Call tprint_iov_upto() for netlink decoding.

(do_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto() for netlink

> (send, sendto, recv, recvfrom): Call printsockbuf().

(printsockbuf): New function.
(SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)):
Use it instead of printstr.

> * netlink.c: New file.
> (decode_netlink): New function.

* netlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.

> @@ -936,11 +960,13 @@ SYS_FUNC(recvfrom)
>  		printfd(tcp, tcp->u_arg[0]);
>  		tprints(", ");
>  	} else {
> +
>  		/* buf */

No need to add an empty line here.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160622/fa954d46/attachment.bin>

More information about the Strace-devel mailing list