On Sat, 4 Jul 2020 at 12:30, Philippe Mathieu-Daudé <f4...@amsat.org> wrote:
> Any idea what means TFR? I understand it keeps retrying while
> interrupted, but can't find the origin of that abbreviation.

Probably it stands for "temporary failure retry" -- glibc provides
essentially the same primitive in unistd.h as TEMP_FAILURE_RETRY:
https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html

TFR is pretty old as QEMU code goes: added in commit aeb30be60a92148e38d
in 2007.

> I'm not sure what we gain by using this macro, it seems dangerous
> as there is no guaranty we 'expr' is a single libc call updating
> errno.

Well, the design of the macro is that it is for use to wrap
expressions which are a single thing that update errno...

The gain overall is that "we need to retry practically everything
to handle EINTR" results in lots of awkward open-coded loops,
and in theory putting them behind macros makes the normal-case
handling more obvious. But this only works if the codebase is
going to consistently adopt TFR() as its EINTR-handling strategy.

(EINTR is one of the big failures of the Unix/POSIX API, in my view.)

thanks
-- PMM

Reply via email to