diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-04-09 16:11:34 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-04-09 16:11:34 +0100 |
commit | 2434aa5074f5f05f102fd9b0d1a33bc6673dafb0 (patch) | |
tree | 2288e0cdb60286692b5171a88789e8da7bdd3773 /tools/libxc/xc_evtchn.c | |
parent | fc7e83c464aa65cadb594a954f763bd0c8aad8ad (diff) | |
download | xen-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/libxc/xc_evtchn.c')
-rw-r--r-- | tools/libxc/xc_evtchn.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index 0992a7bdbb..5e1ca26502 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -9,7 +9,8 @@ #include "xc_private.h" -static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size) +static int do_evtchn_op(int xc_handle, int cmd, void *arg, + size_t arg_size, int silently_fail) { int ret = -1; DECLARE_HYPERCALL; @@ -24,7 +25,7 @@ static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size) goto out; } - if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0) + if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 && !silently_fail) ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret); unlock_pages(arg, arg_size); @@ -44,7 +45,7 @@ xc_evtchn_alloc_unbound(int xc_handle, .remote_dom = (domid_t)remote_dom }; - rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg)); + rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg), 0); if ( rc == 0 ) rc = arg.port; @@ -55,5 +56,20 @@ int xc_evtchn_reset(int xc_handle, uint32_t dom) { struct evtchn_reset arg = { .dom = (domid_t)dom }; - return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg)); + return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg), 0); +} + +int xc_evtchn_status(int xc_handle, + uint32_t dom, + uint32_t port) +{ + int rc; + struct evtchn_status arg = { .dom = (domid_t)dom, + .port = (evtchn_port_t)port }; + + rc = do_evtchn_op(xc_handle, EVTCHNOP_status, &arg, sizeof(arg), 1); + if ( rc == 0 ) + rc = arg.status; + + return rc; } |