From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] do not loop on an incomplete io_thread_fd read
Date: Tue, 2 Feb 2010 20:33:09 +0100 [thread overview]
Message-ID: <1265139191-13568-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1265139191-13568-1-git-send-email-pbonzini@redhat.com>
No need to loop if less than a full buffer is read, the next
read would return EAGAIN.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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)
--
1.6.6
next prev parent reply other threads:[~2010-02-02 19:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 19:33 [Qemu-devel] [PATCH 0/3] Event signaling tweaks Paolo Bonzini
2010-02-02 19:33 ` Paolo Bonzini [this message]
2010-02-10 18:32 ` [Qemu-devel] [PATCH 1/3] do not loop on an incomplete io_thread_fd read Anthony Liguori
2010-02-02 19:33 ` [Qemu-devel] [PATCH 2/3] loop write in qemu_event_increment upon EINTR Paolo Bonzini
2010-02-02 19:33 ` [Qemu-devel] [PATCH 3/3] fix placement of config-host.h inclusion Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1265139191-13568-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).