|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH 1/3] do not loop on an incomplete io_thread_fd read |
Date: | Wed, 10 Feb 2010 12:32:24 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0 |
On 02/02/2010 01:33 PM, Paolo Bonzini wrote:
No need to loop if less than a full buffer is read, the next read would return EAGAIN. Signed-off-by: Paolo Bonzini<address@hidden>
Applied all. Thanks. Regards, Anthony Liguori
--- vl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 6f1e1ab..46c1118 100644 --- a/vl.c +++ b/vl.c @@ -3210,12 +3210,12 @@ static void qemu_event_read(void *opaque) { int fd = (unsigned long)opaque; ssize_t len; + char buffer[512]; /* Drain the notify pipe */ do { - char buffer[512]; len = read(fd, buffer, sizeof(buffer)); - } while ((len == -1&& errno == EINTR) || len> 0); + } while ((len == -1&& errno == EINTR) || len == sizeof(buffer)); } static int qemu_event_init(void)
[Prev in Thread] | Current Thread | [Next in Thread] |