[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu-char: handle EINTR for TCP character devic
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] qemu-char: handle EINTR for TCP character devices |
Date: |
Tue, 21 Jul 2015 10:55:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
On 21/07/2015 10:51, Thomas Huth wrote:
> On 21/07/15 09:34, Paolo Bonzini wrote:
>> Signed-off-by: Paolo Bonzini <address@hidden>
>> ---
>> 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);
>> }
>
> I think you could also use the TFR() macro from include/qemu-common.h
> here instead (TFR = temp. failure retry, I think)
Interesting macro. :) I wonder why it's being used only for open (and
qemu_open), though.
Paolo