aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/main-loop.c4
-rw-r--r--util/osdep.c4
-rw-r--r--util/vfio-helpers.c12
3 files changed, 8 insertions, 12 deletions
diff --git a/util/main-loop.c b/util/main-loop.c
index 10fa74c6e3..58f776a8c9 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -64,9 +64,7 @@ static void sigfd_handler(void *opaque)
ssize_t len;
while (1) {
- do {
- len = read(fd, &info, sizeof(info));
- } while (len == -1 && errno == EINTR);
+ len = RETRY_ON_EINTR(read(fd, &info, sizeof(info)));
if (len == -1 && errno == EAGAIN) {
break;
diff --git a/util/osdep.c b/util/osdep.c
index 77c1a6c562..e996c4744a 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -244,9 +244,7 @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
.l_type = fl_type,
};
qemu_probe_lock_ops();
- do {
- ret = fcntl(fd, fcntl_op_setlk, &fl);
- } while (ret == -1 && errno == EINTR);
+ ret = RETRY_ON_EINTR(fcntl(fd, fcntl_op_setlk, &fl));
return ret == -1 ? -errno : 0;
}
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index 7a84b1d806..2d8af38f88 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -240,9 +240,9 @@ static int qemu_vfio_pci_read_config(QEMUVFIOState *s, void *buf,
s->config_region_info.offset,
s->config_region_info.size);
assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size));
- do {
- ret = pread(s->device, buf, size, s->config_region_info.offset + ofs);
- } while (ret == -1 && errno == EINTR);
+ ret = RETRY_ON_EINTR(
+ pread(s->device, buf, size, s->config_region_info.offset + ofs)
+ );
return ret == size ? 0 : -errno;
}
@@ -254,9 +254,9 @@ static int qemu_vfio_pci_write_config(QEMUVFIOState *s, void *buf, int size, int
s->config_region_info.offset,
s->config_region_info.size);
assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size));
- do {
- ret = pwrite(s->device, buf, size, s->config_region_info.offset + ofs);
- } while (ret == -1 && errno == EINTR);
+ ret = RETRY_ON_EINTR(
+ pwrite(s->device, buf, size, s->config_region_info.offset + ofs)
+ );
return ret == size ? 0 : -errno;
}