diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-09-05 11:56:35 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-09-05 11:56:35 +0100 |
commit | 406b8494bb6b72abd13da118da1f4c82433e4de8 (patch) | |
tree | 94667380c2f2cb11d3d3faa9744286dbb0169838 /tools/xcutils | |
parent | b95d528041324423fc91174913ec0d98dad75e6f (diff) | |
download | xen-406b8494bb6b72abd13da118da1f4c82433e4de8.tar.gz xen-406b8494bb6b72abd13da118da1f4c82433e4de8.tar.bz2 xen-406b8494bb6b72abd13da118da1f4c82433e4de8.zip |
lsevtchn: Improve this evtchn reporting tool.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools/xcutils')
-rw-r--r-- | tools/xcutils/lsevtchn.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c index 3dc3cb3c42..7e7bcbeff7 100644 --- a/tools/xcutils/lsevtchn.c +++ b/tools/xcutils/lsevtchn.c @@ -8,49 +8,55 @@ #include <xenctrl.h> #include <xenguest.h> -int -main(int argc, char **argv) +int main(int argc, char **argv) { - int xc_fd; - int domid = 0, port = 0, status; - const char *msg; + int xc_fd, domid, port, rc; + xc_evtchn_status_t status; - if ( argc > 1 ) - domid = strtol(argv[1], NULL, 10); + domid = (argc > 1) ? strtol(argv[1], NULL, 10) : 0; xc_fd = xc_interface_open(); if ( xc_fd < 0 ) errx(1, "failed to open control interface"); - while ( (status = xc_evtchn_status(xc_fd, domid, port)) >= 0 ) + for ( port = 0; ; port++ ) { - switch ( status ) - { - case EVTCHNSTAT_closed: - msg = "Channel is not in use."; + status.dom = domid; + status.port = port; + rc = xc_evtchn_status(xc_fd, &status); + if ( rc < 0 ) break; + + if ( status.status == EVTCHNSTAT_closed ) + continue; + + printf("%4d: VCPU %u: ", port, status.vcpu); + + switch ( status.status ) + { case EVTCHNSTAT_unbound: - msg = "Channel is waiting interdom connection."; + printf("Interdomain (Waiting connection) - Remote Domain %u", + status.u.unbound.dom); break; case EVTCHNSTAT_interdomain: - msg = "Channel is connected to remote domain."; + printf("Interdomain (Connected) - Remote Domain %u, Port %u", + status.u.interdomain.dom, status.u.interdomain.port); break; case EVTCHNSTAT_pirq: - msg = "Channel is bound to a phys IRQ line."; + printf("Physical IRQ %u", status.u.pirq); break; case EVTCHNSTAT_virq: - msg = "Channel is bound to a virtual IRQ line."; + printf("Virtual IRQ %u", status.u.virq); break; case EVTCHNSTAT_ipi: - msg = "Channel is bound to a virtual IPI line."; + printf("IPI"); break; default: - msg = "Unknown."; + printf("Unknown"); break; - } - printf("%03d: %d: %s\n", port, status, msg); - port++; + + printf("\n"); } xc_interface_close(xc_fd); |