[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH 2/2] tools/lsevtchn: Use evtchn port upper bound for evtchn enumeration



lsevtchn terminates the loop when the hypercall returns an error, even
if there are still event channels with higher port numbers to be
enumerated over.

Use the highest allocated event channel port number for a given domain
to bound the loop so that all relevant event channels can be enumerated
over.

Signed-off-by: Matthew Barnes <matthew.barnes@xxxxxxxxx>
---
 tools/xcutils/lsevtchn.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613ddc5..7f8ad7c8e7ce 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -11,6 +11,7 @@ int main(int argc, char **argv)
     xc_interface *xch;
     int domid, port, rc;
     xc_evtchn_status_t status;
+    xc_domaininfo_t info;
 
     domid = (argc > 1) ? strtol(argv[1], NULL, 10) : 0;
 
@@ -18,13 +19,16 @@ int main(int argc, char **argv)
     if ( !xch )
         errx(1, "failed to open control interface");
 
-    for ( port = 0; ; port++ )
+    if ( xc_domain_getinfo_single(xch, domid, &info) < 0 )
+        errx(1, "failed to fetch domain info");
+
+    for ( port = 0; port <= info.highest_evtchn_port; port++ )
     {
         status.dom = domid;
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+            continue;
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.