aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_minios.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-24 14:11:47 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-24 14:11:47 +0100
commit597e548eef7de6cba2f30f47a7f3177e31cadbeb (patch)
treefbca5c74729978a257b423acb789d4cce8d71282 /tools/libxc/xc_minios.c
parentfd6a37dbdcdf53a65f27115aebfc0a57e0040004 (diff)
downloadxen-597e548eef7de6cba2f30f47a7f3177e31cadbeb.tar.gz
xen-597e548eef7de6cba2f30f47a7f3177e31cadbeb.tar.bz2
xen-597e548eef7de6cba2f30f47a7f3177e31cadbeb.zip
mini-os: select call incorrectly reports xce_handle as ready
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>
Diffstat (limited to 'tools/libxc/xc_minios.c')
-rw-r--r--tools/libxc/xc_minios.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c
index 4a5a351aeb..a07b17dd6f 100644
--- a/tools/libxc/xc_minios.c
+++ b/tools/libxc/xc_minios.c
@@ -292,18 +292,24 @@ 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)