[PATCH 3/4] Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg

Dmitry V. Levin ldv at altlinux.org
Thu Nov 6 17:41:26 UTC 2014


On Fri, Nov 07, 2014 at 01:23:26AM +0900, Masatake YAMATO wrote:
> This patch is similar to what I did in commit
> 02f9f6b386741a52f58e1b31ad4e7fff60781ef8.  The commit was for sendmsg
> and recvmsg system calls. This one is for sendmmsg and recvmmsg system
> calls.
[...]
> --- a/net.c
> +++ b/net.c
> @@ -430,6 +430,36 @@ extractmsghdr(struct tcb *tcp, long addr, struct msghdr *msg)
>  	return true;
>  }
>  
> +static bool
> +extractmmsghdr0(struct tcb *tcp, long addr, struct mmsghdr *mmsg)
> +{
> +#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
> +	if (current_wordsize == 4) {
> +		struct mmsghdr32 mmsg32;
> +
> +		if (umove(tcp, addr, &mmsg32) < 0)
> +			return false;
> +		copy_from_msghdr32(&mmsg->msg_hdr, &mmsg32.msg_hdr);
> +		mmsg->msg_len = mmsg32.msg_len;
> +	} else
> +#endif
> +	 if (umove(tcp, addr, mmsg) < 0)
> +		 return false;
> +	return true;
> +}
> +
> +static bool
> +extractmmsghdr(struct tcb *tcp, long addr, unsigned int idx, struct mmsghdr *mmsg)
> +{
> +#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
> +	if (current_wordsize == 4)
> +		addr += sizeof(struct mmsghdr32) * idx;
> +	else
> +#endif
> +		addr += sizeof(*mmsg) * idx;
> +	return extractmmsghdr0(tcp, addr, mmsg);
> +}
> +

Do we really need extractmmsghdr0 as a separate function?


-- 
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/c09508f8/attachment.bin>


More information about the Strace-devel mailing list