aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>2004-10-22 15:56:04 +0000
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>2004-10-22 15:56:04 +0000
commit1eebbaadef7ca9527e8713becef80a083635ab25 (patch)
treeecbc8bfbda0fdfff3776ab9b787c088c2feb9ddf /tools
parent1d3898f2613159e767d9be1f5ec81c93f4d43eb9 (diff)
parent6f46072ed02afb1fa6c9b2d72231b27e9b776958 (diff)
downloadxen-1eebbaadef7ca9527e8713becef80a083635ab25.tar.gz
xen-1eebbaadef7ca9527e8713becef80a083635ab25.tar.bz2
xen-1eebbaadef7ca9527e8713becef80a083635ab25.zip
bitkeeper revision 1.1159.1.261 (41792d94c9Ck-m72kpZkL5_a2aSoZA)
Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0 into freefall.cl.cam.ac.uk:/local/scratch/cl349/xeno.bk-24dom0
Diffstat (limited to 'tools')
-rw-r--r--tools/libxc/xc.h3
-rw-r--r--tools/libxc/xc_evtchn.c29
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c37
-rw-r--r--tools/python/xen/lowlevel/xu/xu.c2
4 files changed, 62 insertions, 9 deletions
diff --git a/tools/libxc/xc.h b/tools/libxc/xc.h
index ddee505e5f..027d76711f 100644
--- a/tools/libxc/xc.h
+++ b/tools/libxc/xc.h
@@ -146,6 +146,9 @@ typedef struct {
} u;
} xc_evtchn_status_t;
+int xc_evtchn_alloc_unbound(int xc_handle,
+ u32 dom,
+ int *port);
int xc_evtchn_bind_interdomain(int xc_handle,
u32 dom1, /* may be DOMID_SELF */
u32 dom2, /* may be DOMID_SELF */
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c
index 52f7377467..2f78ef7936 100644
--- a/tools/libxc/xc_evtchn.c
+++ b/tools/libxc/xc_evtchn.c
@@ -31,6 +31,26 @@ static int do_evtchn_op(int xc_handle, evtchn_op_t *op)
}
+int xc_evtchn_alloc_unbound(int xc_handle,
+ u32 dom,
+ int *port)
+{
+ evtchn_op_t op;
+ int rc;
+
+ op.cmd = EVTCHNOP_alloc_unbound;
+ op.u.alloc_unbound.dom = (domid_t)dom;
+
+ if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
+ {
+ if ( port != NULL )
+ *port = op.u.alloc_unbound.port;
+ }
+
+ return rc;
+}
+
+
int xc_evtchn_bind_interdomain(int xc_handle,
u32 dom1,
u32 dom2,
@@ -41,9 +61,12 @@ int xc_evtchn_bind_interdomain(int xc_handle,
int rc;
op.cmd = EVTCHNOP_bind_interdomain;
- op.u.bind_interdomain.dom1 = (domid_t)dom1;
- op.u.bind_interdomain.dom2 = (domid_t)dom2;
-
+ op.u.bind_interdomain.dom1 = (domid_t)dom1;
+ op.u.bind_interdomain.dom2 = (domid_t)dom2;
+ op.u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0;
+ op.u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0;
+
+
if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
{
if ( port1 != NULL )
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 61287b2c38..2dd8680b4f 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -462,6 +462,26 @@ static PyObject *pyxc_bvtsched_domain_get(PyObject *self,
"warpu", warpu);
}
+static PyObject *pyxc_evtchn_alloc_unbound(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ XcObject *xc = (XcObject *)self;
+
+ u32 dom;
+ int port;
+
+ static char *kwd_list[] = { "dom", NULL };
+
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
+ return NULL;
+
+ if ( xc_evtchn_alloc_unbound(xc->xc_handle, dom, &port) != 0 )
+ return PyErr_SetFromErrno(xc_error);
+
+ return PyInt_FromLong(port);
+}
+
static PyObject *pyxc_evtchn_bind_interdomain(PyObject *self,
PyObject *args,
PyObject *kwds)
@@ -469,12 +489,12 @@ static PyObject *pyxc_evtchn_bind_interdomain(PyObject *self,
XcObject *xc = (XcObject *)self;
u32 dom1 = DOMID_SELF, dom2 = DOMID_SELF;
- int port1, port2;
+ int port1 = 0, port2 = 0;
- static char *kwd_list[] = { "dom1", "dom2", NULL };
+ static char *kwd_list[] = { "dom1", "dom2", "port1", "port2", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
- &dom1, &dom2) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiii", kwd_list,
+ &dom1, &dom2, &port1, &port2) )
return NULL;
if ( xc_evtchn_bind_interdomain(xc->xc_handle, dom1,
@@ -965,6 +985,13 @@ static PyMethodDef pyxc_methods[] = {
"Returns [dict]:\n"
" slice [long]: Scheduler time slice.\n" },
+ { "evtchn_alloc_unbound",
+ (PyCFunction)pyxc_evtchn_alloc_unbound,
+ METH_VARARGS | METH_KEYWORDS, "\n"
+ "Allocate an unbound local port that will await a remote connection.\n"
+ " dom [int]: Remote domain to accept connections from.\n\n"
+ "Returns: [int] Unbound event-channel port.\n" },
+
{ "evtchn_bind_interdomain",
(PyCFunction)pyxc_evtchn_bind_interdomain,
METH_VARARGS | METH_KEYWORDS, "\n"
@@ -985,7 +1012,7 @@ static PyMethodDef pyxc_methods[] = {
{ "evtchn_close",
(PyCFunction)pyxc_evtchn_close,
METH_VARARGS | METH_KEYWORDS, "\n"
- "Close an event channel.\n"
+ "Close an event channel. If interdomain, sets remote end to 'unbound'.\n"
" dom [int, SELF]: Dom-id of one endpoint of the channel.\n"
" port [int]: Port-id of one endpoint of the channel.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
diff --git a/tools/python/xen/lowlevel/xu/xu.c b/tools/python/xen/lowlevel/xu/xu.c
index db3aa1d5d4..4af52375fd 100644
--- a/tools/python/xen/lowlevel/xu/xu.c
+++ b/tools/python/xen/lowlevel/xu/xu.c
@@ -1059,7 +1059,7 @@ static PyObject *xu_port_new(PyObject *self, PyObject *args)
{
xu_port_object *xup;
u32 dom;
- int port1, port2;
+ int port1 = 0, port2 = 0;
if ( !PyArg_ParseTuple(args, "i", &dom) )
return NULL;