[PATCH 2/4] Use the definition of struct mmsghdr if it is defined in build environment

Dmitry V. Levin ldv at altlinux.org
Thu Nov 6 17:28:47 UTC 2014


On Fri, Nov 07, 2014 at 01:23:25AM +0900, Masatake YAMATO wrote:
> mmsghrd structure type is defined locally in printmmsghdr function.
> 
> However, more functions will refer the definition in modifications for
> supporting "-e write=all" and "-e read=all" option for sendmmsg and
> recvmmsg system calls.
> 
> In this patch, strace uses the definition of struct mmsghdr in build
> environment if configure reports it is available; and uses own
> definition in the top level of net.c if configure doesn't reports it
> is available.
> 
> * configure.ac (struct mmsghdr): Check whether the structure
>   definition is available or not.
> 
> * net.c (struct mmsghdr): Define the structure type if configure
>   doesn't report it is available in the build environment.
> 
>   (printmmsghdr): Don't define struct mmsghdr type locally.
> 
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
>  configure.ac |  4 ++++
>  net.c        | 12 ++++++++----
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9caa835..01df6f2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -260,6 +260,10 @@ AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
>  AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
>  
>  AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
> +AC_CHECK_TYPES([struct mmsghdr],,, [
> +#define _GNU_SOURCE
> +#include <sys/socket.h>
> +])

Why _GNU_SOURCE?  Since we use AC_USE_SYSTEM_EXTENSIONS in the beginning
of configure.ac, this define shouldn't be needed.


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


More information about the Strace-devel mailing list