From: Diego Ongaro <diego.ongaro@citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] mini-os: select call incorrectly reports xce_handle as ready
Date: Wed, 23 Jul 2008 18:01:12 +0100 [thread overview]
Message-ID: <488763D8.8020205@citrix.com> (raw)
The current implementation in minios of xc_evtchn_pending doesn't set
read=0 when there is exactly one port pending. This resulted in select()
incorrectly reporting the file descriptor as ready.
Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
---
diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c
+++ b/tools/libxc/xc_minios.c
@@ -287,22 +287,28 @@
evtchn_port_or_error_t xc_evtchn_pending(int xce_handle)
{
int i;
unsigned long flags;
+ evtchn_port_t ret = -1;
+
local_irq_save(flags);
+ files[xce_handle].read = 0;
for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
- evtchn_port_t port = files[xce_handle].evtchn.ports[i].port;
- if (port != -1 && files[xce_handle].evtchn.ports[i].pending) {
- files[xce_handle].evtchn.ports[i].pending = 0;
- local_irq_restore(flags);
- return port;
- }
+ evtchn_port_t port = files[xce_handle].evtchn.ports[i].port;
+ if (port != -1 && files[xce_handle].evtchn.ports[i].pending) {
+ if (ret == -1) {
+ ret = port;
+ files[xce_handle].evtchn.ports[i].pending = 0;
+ } else {
+ files[xce_handle].read = 1;
+ break;
+ }
+ }
}
- files[xce_handle].read = 0;
local_irq_restore(flags);
- return -1;
+ return ret;
}
int xc_evtchn_unmask(int xce_handle, evtchn_port_t port)
{
unmask_evtchn(port);
reply other threads:[~2008-07-23 17:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=488763D8.8020205@citrix.com \
--to=diego.ongaro@citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.