aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2010-02-02 20:33:10 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-02-10 11:56:56 -0600
commit652ce2d449f47cdc4d94eb67f2377504c06957ad (patch)
tree9802fe86f270775665863da37af452816f9b29f0
parent1d0f0d91f298cbda1990edc92cf8ac306c474cdf (diff)
loop write in qemu_event_increment upon EINTR
Same as what qemu-kvm does. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--vl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index f98661f34e..29f218987a 100644
--- a/vl.c
+++ b/vl.c
@@ -3217,8 +3217,12 @@ static void qemu_event_increment(void)
if (io_thread_fd == -1)
return;
- ret = write(io_thread_fd, &byte, sizeof(byte));
- if (ret < 0 && (errno != EINTR && errno != EAGAIN)) {
+ do {
+ ret = write(io_thread_fd, &byte, sizeof(byte));
+ } while (ret < 0 && errno == EINTR);
+
+ /* EAGAIN is fine, a read must be pending. */
+ if (ret < 0 && errno != EAGAIN) {
fprintf(stderr, "qemu_event_increment: write() filed: %s\n",
strerror(errno));
exit (1);