All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-trivial] [PATCH] iov_send_recv(): Handle zero bytes case even if OS does not
Date: Sun, 12 Aug 2012 14:32:24 +0400	[thread overview]
Message-ID: <50278638.4070206@msgid.tls.msk.ru> (raw)
In-Reply-To: <1344720275-26744-1-git-send-email-peter.maydell@linaro.org>

On 12.08.2012 01:24, Peter Maydell wrote:
> POSIX allows sendmsg() and recvmsg() to fail EMSGSIZE if passed a zero
> msg.msg_iovlen (in particular the MacOS X implementation will do this).
> Handle the case where iov_send_recv() is passed a zero byte count
> explicitly, to avoid accidentally depending on the OS to treat zero
> msg_iovlen as a no-op.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This is what was causing 'make check' to fail on MacOS X.
> The other option was to declare that a zero bytecount was illegal, I guess.

Acked-by: Michael Tokarev <mjt@tls.msk.ru>

Kevin, does this fix the test-iov failure you're seeing on one of
the build bots?

Thank you!

/mjt

>  iov.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/iov.c b/iov.c
> index b333061..60705c7 100644
> --- a/iov.c
> +++ b/iov.c
> @@ -146,6 +146,13 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
>  {
>      ssize_t ret;
>      unsigned si, ei;            /* start and end indexes */
> +    if (bytes == 0) {
> +        /* Catch the do-nothing case early, as otherwise we will pass an
> +         * empty iovec to sendmsg/recvmsg(), and not all implementations
> +         * accept this.
> +         */
> +        return 0;
> +    }
>  
>      /* Find the start position, skipping `offset' bytes:
>       * first, skip all full-sized vector elements, */



WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] iov_send_recv(): Handle zero bytes case even if OS does not
Date: Sun, 12 Aug 2012 14:32:24 +0400	[thread overview]
Message-ID: <50278638.4070206@msgid.tls.msk.ru> (raw)
In-Reply-To: <1344720275-26744-1-git-send-email-peter.maydell@linaro.org>

On 12.08.2012 01:24, Peter Maydell wrote:
> POSIX allows sendmsg() and recvmsg() to fail EMSGSIZE if passed a zero
> msg.msg_iovlen (in particular the MacOS X implementation will do this).
> Handle the case where iov_send_recv() is passed a zero byte count
> explicitly, to avoid accidentally depending on the OS to treat zero
> msg_iovlen as a no-op.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This is what was causing 'make check' to fail on MacOS X.
> The other option was to declare that a zero bytecount was illegal, I guess.

Acked-by: Michael Tokarev <mjt@tls.msk.ru>

Kevin, does this fix the test-iov failure you're seeing on one of
the build bots?

Thank you!

/mjt

>  iov.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/iov.c b/iov.c
> index b333061..60705c7 100644
> --- a/iov.c
> +++ b/iov.c
> @@ -146,6 +146,13 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
>  {
>      ssize_t ret;
>      unsigned si, ei;            /* start and end indexes */
> +    if (bytes == 0) {
> +        /* Catch the do-nothing case early, as otherwise we will pass an
> +         * empty iovec to sendmsg/recvmsg(), and not all implementations
> +         * accept this.
> +         */
> +        return 0;
> +    }
>  
>      /* Find the start position, skipping `offset' bytes:
>       * first, skip all full-sized vector elements, */

  parent reply	other threads:[~2012-08-12 10:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-11 21:24 [Qemu-trivial] [PATCH] iov_send_recv(): Handle zero bytes case even if OS does not Peter Maydell
2012-08-11 21:24 ` [Qemu-devel] " Peter Maydell
2012-08-12  5:29 ` [Qemu-trivial] " Michael Tokarev
2012-08-12  5:29   ` [Qemu-devel] " Michael Tokarev
2012-08-12  9:12   ` [Qemu-trivial] " Peter Maydell
2012-08-12  9:12     ` [Qemu-devel] " Peter Maydell
2012-08-12 10:32 ` Michael Tokarev [this message]
2012-08-12 10:32   ` Michael Tokarev
2012-08-13  7:26   ` [Qemu-trivial] " Kevin Wolf
2012-08-13  7:26     ` [Qemu-devel] " Kevin Wolf
2012-08-15 14:21 ` [Qemu-trivial] " Stefan Hajnoczi
2012-08-15 14:21   ` [Qemu-devel] " Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50278638.4070206@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=kwolf@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.