[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hw/char/serial: Only retry if qemu_chr_fe_write
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] hw/char/serial: Only retry if qemu_chr_fe_write returns 0 |
Date: |
Mon, 9 Jul 2018 15:44:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 09/07/2018 15:21, Peter Maydell wrote:
>>
>> However, indeed it seems to me that the logic of the patch is backwards:
>>
>> - -1/EAGAIN should retry
>>
>> - 0 should *not* retry, because it means the other side has hung up
> This seems weird, because it doesn't follow the usual pattern
> for non-blocking functions, where 0 just means "nothing was
> written" and actual error conditions like the other side having
> gone away are reported via -1 and some errno.
>
Ah no, that's read(2). write(2) is as you say, so the patch should
check for EAGAIN.
Paolo