On 9 July 2018 at 11:25, Marc-André Lureau <marcandre.lur...@gmail.com> 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