[Top][All Lists]

[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: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] hw/char/serial: Only retry if qemu_chr_fe_write returns 0
Date: Mon, 9 Jul 2018 14:21:59 +0100

On 9 July 2018 at 14:17, Paolo Bonzini <address@hidden> wrote:
> On 09/07/2018 14:23, Marc-André Lureau wrote:
>> I suppose the patch should also change qemu_chr_fe_write() to
>> qemu_chr_fe_write_all() to be complete and let the chardev handle
> No, using qemu_chr_fe_write_all() is even more wrong, because hw/char
> devices should never block (and hw/char/serial.c handles flow control
> properly).
> 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.

> - everything else should not retry.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]