diff options
author | Nikita Ivanov <nivanov@cloudlinux.com> | 2022-10-23 12:04:21 +0300 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-01-09 13:50:47 +0100 |
commit | 8b6aa69365ca6e9bbc3bf557a6ccc5ed2b468bec (patch) | |
tree | d25851818abc8b11d99b4455dca2d67afd013210 /include | |
parent | d88ce91299053c437f42d22ab5b9e7adbd2cc2a7 (diff) |
Refactoring: refactor TFR() macro to RETRY_ON_EINTR()
Rename macro name to more transparent one and refactor
it to expression.
Signed-off-by: Nikita Ivanov <nivanov@cloudlinux.com>
Message-Id: <20221023090422.242617-2-nivanov@cloudlinux.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/osdep.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b9c4307779..7d059ad526 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -251,7 +251,13 @@ void QEMU_ERROR("code path is reachable") #define ESHUTDOWN 4099 #endif -#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) +#define RETRY_ON_EINTR(expr) \ + (__extension__ \ + ({ typeof(expr) __result; \ + do { \ + __result = (expr); \ + } while (__result == -1 && errno == EINTR); \ + __result; })) /* time_t may be either 32 or 64 bits depending on the host OS, and * can be either signed or unsigned, so we can't just hardcode a |