[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 13:11:38 +0100 |
On 9 July 2018 at 11:25, Marc-André Lureau <address@hidden> wrote:
> Shouldn't it rety if it returns -1 and the errno == EAGAIN? I am not
> sure when it would return 0 and a retry would make sense.
This came up in previous discussion on an earlier version of this:
https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg00171.html
qemu_chr_fe_write() should never return -1/EAGAIN, because then
all of its callers need to deal with it. It should handle EAGAIN
internally and report "try again later" by returning 0.
The logic is that (a) EAGAIN is a pain to handle and we should
avoid expanding the set of places in QEMU that has to care about
it where we can and (b) this function already has a way to say
'try again later' (ie, returning 0), so it is confusing and
complicates callsites to give it a second way to say the same
thing (ie, returning -1/EINTR). Better to always report "try
again" in the same way.
thanks
-- PMM