From caf6a438f9d97684c10da8a6453d1e0e151a9613 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Fri, 7 Nov 2014 01:23:25 +0900 Subject: [PATCH] Use the definition of struct mmsghdr if it is defined in build environment mmsghrd structure type is defined locally in printmmsghdr function. However, more functions will refer the definition in modifications for supporting "-e write=set" and "-e read=set" option for sendmmsg and recvmmsg system calls. After this change, the system definition of struct mmsghdr will be used if configure reports it is available, falling back to the old local definition. * configure.ac (AC_CHECK_TYPES): Add struct mmsghdr. * net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define. (printmmsghdr): Use previously defined struct mmsghdr. Signed-off-by: Masatake YAMATO --- configure.ac | 1 + net.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 98669fa3..7862f65d 100644 --- a/configure.ac +++ b/configure.ac @@ -260,6 +260,7 @@ AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include ]) AC_CHECK_TYPES([struct sigcontext],,, [#include ]) AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include ]) +AC_CHECK_TYPES([struct mmsghdr],,, [#include ]) AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include ]) AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include ]) diff --git a/net.c b/net.c index 41c55c66..9e9e1591 100644 --- a/net.c +++ b/net.c @@ -429,6 +429,13 @@ 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) @@ -483,10 +490,7 @@ dumpiov_in_msghdr(struct tcb *tcp, long addr) static void printmmsghdr(struct tcb *tcp, long addr, unsigned int idx, unsigned long msg_len) { - struct mmsghdr { - struct msghdr msg_hdr; - unsigned msg_len; - } mmsg; + struct mmsghdr mmsg; #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 if (current_wordsize == 4) { -- 2.40.0