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

Dmitry V. Levin ldv at altlinux.org
Fri Nov 7 03:53:34 UTC 2014


On Fri, Nov 07, 2014 at 11:38:20AM +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.
> 
> In v2 patch: Don't define _GNU_SOURCE when checking the availability.
> AC_USE_SYSTEM_EXTENSIONS in the beginning of configure.ac does.
> Suggested by ldv.
> 
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
>  configure.ac |  3 +++
>  net.c        | 12 ++++++++----
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9caa835..9903693 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -260,6 +260,9 @@ 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],,, [
> +#include <sys/socket.h>
> +])

For the sake of better readability, I'd rather check the type first,
and its member afterwards:

AC_CHECK_TYPES([struct mmsghdr],,, [[#include <sys/socket.h>])
AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])

P.S. No need to repost this and 1/4 patch.


-- 
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/20141107/30b3ab54/attachment.bin>


More information about the Strace-devel mailing list