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

Masatake YAMATO yamato at redhat.com
Fri Nov 7 04:59:31 UTC 2014


Hi,

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

Thank you for reviewing. I will revise the 3/4 and 4/4 patches.

Masatake YAMATO

On Fri, 7 Nov 2014 06:53:34 +0300, "Dmitry V. Levin" <ldv at altlinux.org> wrote:
> 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




More information about the Strace-devel mailing list