From: Dmitry V. Levin Date: Mon, 27 Jun 2016 00:02:41 +0000 (+0000) Subject: net.c: move fallback definition of struct mmsghdr to a separate file. X-Git-Tag: v4.13~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b38ce956c270a28fd0aa018f448b082371a08b1;p=strace net.c: move fallback definition of struct mmsghdr to a separate file. * msghdr.h: New file. * Makefile.am (strace_SOURCES): Add it. * net.c: Include it. Move fallback definition of struct mmsghdr there. * tests/mmsg.c: Include "msghdr.h". Remove fallback definition of struct mmsghdr. --- diff --git a/Makefile.am b/Makefile.am index c506f165..1a578376 100644 --- a/Makefile.am +++ b/Makefile.am @@ -153,6 +153,7 @@ strace_SOURCES = \ mount.c \ mpers_type.h \ mq.c \ + msghdr.h \ mtd.c \ native_defs.h \ net.c \ diff --git a/msghdr.h b/msghdr.h new file mode 100644 index 00000000..9cf98547 --- /dev/null +++ b/msghdr.h @@ -0,0 +1,14 @@ +#ifndef MSGHDR_H_ +# define MSGHDR_H_ + +/* For definitions of struct msghdr and struct mmsghdr. */ +# include + +# ifndef HAVE_STRUCT_MMSGHDR +struct mmsghdr { + struct msghdr msg_hdr; + unsigned msg_len; +}; +# endif + +#endif /* MSGHDR_H_ */ diff --git a/net.c b/net.c index c5ecf123..3a7f9403 100644 --- a/net.c +++ b/net.c @@ -29,6 +29,7 @@ */ #include "defs.h" +#include "msghdr.h" #include #include #include @@ -440,13 +441,6 @@ struct mmsghdr32 { uint32_t /* unsigned */ msg_len; }; -#ifndef HAVE_STRUCT_MMSGHDR -struct mmsghdr { - struct msghdr msg_hdr; - unsigned msg_len; -}; -#endif - #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 static void copy_from_msghdr32(struct msghdr *to_msg, struct msghdr32 *from_msg32) diff --git a/tests/mmsg.c b/tests/mmsg.c index 85e61d5c..00e1ef33 100644 --- a/tests/mmsg.c +++ b/tests/mmsg.c @@ -36,14 +36,8 @@ # include # include # include -# include - -# ifndef HAVE_STRUCT_MMSGHDR -struct mmsghdr { - struct msghdr msg_hdr; - unsigned msg_len; -}; -# endif + +# include "msghdr.h" static int send_mmsg(int fd, struct mmsghdr *vec, unsigned int vlen, unsigned int flags)