aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xcutils
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-04-09 16:11:34 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-04-09 16:11:34 +0100
commit2434aa5074f5f05f102fd9b0d1a33bc6673dafb0 (patch)
tree2288e0cdb60286692b5171a88789e8da7bdd3773 /tools/xcutils
parentfc7e83c464aa65cadb594a954f763bd0c8aad8ad (diff)
downloadxen-2434aa5074f5f05f102fd9b0d1a33bc6673dafb0.tar.gz
xen-2434aa5074f5f05f102fd9b0d1a33bc6673dafb0.tar.bz2
xen-2434aa5074f5f05f102fd9b0d1a33bc6673dafb0.zip
lsevtchn: Simple tool to list event channel states for a domain.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Diffstat (limited to 'tools/xcutils')
-rw-r--r--tools/xcutils/Makefile2
-rw-r--r--tools/xcutils/lsevtchn.c59
2 files changed, 60 insertions, 1 deletions
diff --git a/tools/xcutils/Makefile b/tools/xcutils/Makefile
index d38e8ac07d..15c0c9758e 100644
--- a/tools/xcutils/Makefile
+++ b/tools/xcutils/Makefile
@@ -18,7 +18,7 @@ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore)
CFLAGS += -Wp,-MD,.$(@F).d
PROG_DEP = .*.d
-PROGRAMS = xc_restore xc_save readnotes
+PROGRAMS = xc_restore xc_save readnotes lsevtchn
LDLIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
new file mode 100644
index 0000000000..3dc3cb3c42
--- /dev/null
+++ b/tools/xcutils/lsevtchn.c
@@ -0,0 +1,59 @@
+#include <err.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <xs.h>
+#include <xenctrl.h>
+#include <xenguest.h>
+
+int
+main(int argc, char **argv)
+{
+ int xc_fd;
+ int domid = 0, port = 0, status;
+ const char *msg;
+
+ if ( argc > 1 )
+ domid = strtol(argv[1], NULL, 10);
+
+ 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 )
+ {
+ switch ( status )
+ {
+ case EVTCHNSTAT_closed:
+ msg = "Channel is not in use.";
+ break;
+ case EVTCHNSTAT_unbound:
+ msg = "Channel is waiting interdom connection.";
+ break;
+ case EVTCHNSTAT_interdomain:
+ msg = "Channel is connected to remote domain.";
+ break;
+ case EVTCHNSTAT_pirq:
+ msg = "Channel is bound to a phys IRQ line.";
+ break;
+ case EVTCHNSTAT_virq:
+ msg = "Channel is bound to a virtual IRQ line.";
+ break;
+ case EVTCHNSTAT_ipi:
+ msg = "Channel is bound to a virtual IPI line.";
+ break;
+ default:
+ msg = "Unknown.";
+ break;
+
+ }
+ printf("%03d: %d: %s\n", port, status, msg);
+ port++;
+ }
+
+ xc_interface_close(xc_fd);
+
+ return 0;
+}