All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Amit Shah <amit.shah@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] qemu-char: handle EINTR for TCP character devices
Date: Tue, 21 Jul 2015 10:16:23 +0200	[thread overview]
Message-ID: <55ADFFD7.3010309@redhat.com> (raw)
In-Reply-To: <CAFEAcA_bVJXcYOhveTiE3VCmQZv_JopoJZjgK6_FzQ1_q66nnA@mail.gmail.com>



On 21/07/2015 10:10, Peter Maydell wrote:
> On 21 July 2015 at 08:34, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  qemu-char.c | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/qemu-char.c b/qemu-char.c
>> index b2b43c5..d956f8d 100644
>> --- a/qemu-char.c
>> +++ b/qemu-char.c
>> @@ -2798,7 +2798,10 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
>>  #ifdef MSG_CMSG_CLOEXEC
>>      flags |= MSG_CMSG_CLOEXEC;
>>  #endif
>> -    ret = recvmsg(s->fd, &msg, flags);
>> +    do {
>> +        ret = recvmsg(s->fd, &msg, flags);
>> +    } while (ret == -1 && errno == EINTR);
>> +
>>      if (ret > 0 && s->is_unix) {
>>          unix_process_msgfd(chr, &msg);
>>      }
>> @@ -2809,7 +2812,13 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
>>  static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
>>  {
>>      TCPCharDriver *s = chr->opaque;
>> -    return qemu_recv(s->fd, buf, len, 0);
>> +    ssize_t ret;
>> +
>> +    do {
>> +        ret = qemu_recv(s->fd, buf, len, 0);
>> +    } while (ret == -1 && socket_error() == EINTR);
>> +
>> +    return ret;
>>  }
> 
> ...can you get EINTR on Windows sockets?

No idea, but WSAEINTR exists and even has some hits on Google. :)

Paolo

  reply	other threads:[~2015-07-21  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21  7:34 [Qemu-devel] [PATCH] qemu-char: handle EINTR for TCP character devices Paolo Bonzini
2015-07-21  8:10 ` Peter Maydell
2015-07-21  8:16   ` Paolo Bonzini [this message]
2015-07-21  8:36 ` Amit Shah
2015-07-21  8:45 ` Nils Carlson
2015-07-21  8:51 ` Thomas Huth
2015-07-21  8:55   ` Paolo Bonzini

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=55ADFFD7.3010309@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@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.