diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2010-02-02 20:33:10 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-02-10 11:56:56 -0600 |
commit | 652ce2d449f47cdc4d94eb67f2377504c06957ad (patch) | |
tree | 9802fe86f270775665863da37af452816f9b29f0 | |
parent | 1d0f0d91f298cbda1990edc92cf8ac306c474cdf (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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); |