From: Euan Harris <euan.harris@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Euan Harris <euan.harris@citrix.com>, marmarek@invisiblethingslab.com
Subject: [PATCH v2 1/3] python: Add binding for xs_fileno()
Date: Thu, 21 Sep 2017 17:47:06 +0100 [thread overview]
Message-ID: <1506012428-59769-2-git-send-email-euan.harris@citrix.com> (raw)
In-Reply-To: <1506012428-59769-1-git-send-email-euan.harris@citrix.com>
xs_fileno() returns a file descriptor which receives events when Xenstore
watches fire. Exposing this in the Python bindings is a prerequisite
for writing event-driven clients in Python.
Signed-off-by: Euan Harris <euan.harris@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
tools/python/xen/lowlevel/xs/xs.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index aba5a20..9f1b916 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -453,6 +453,25 @@ static PyObject *xspy_watch(XsHandle *self, PyObject *args)
}
+#define xspy_fileno_doc "\n" \
+ "Return the FD to poll for notifications when watches fire.\n" \
+ "Returns: [int] file descriptor.\n" \
+ "\n"
+
+static PyObject *xspy_fileno(XsHandle *self)
+{
+ struct xs_handle *xh = xshandle(self);
+ int fd;
+
+ if (!xh)
+ return NULL;
+
+ fd = xs_fileno(xh);
+
+ return PyInt_FromLong(fd);
+}
+
+
#define xspy_read_watch_doc "\n" \
"Read a watch notification.\n" \
"\n" \
@@ -887,6 +906,7 @@ static PyMethodDef xshandle_methods[] = {
XSPY_METH(release_domain, METH_VARARGS),
XSPY_METH(close, METH_NOARGS),
XSPY_METH(get_domain_path, METH_VARARGS),
+ XSPY_METH(fileno, METH_NOARGS),
{ NULL /* Sentinel. */ },
};
--
1.8.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-21 16:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 16:47 [PATCH v2 0/3] python: Add non-blocking Xenstore watch bindings Euan Harris
2017-09-21 16:47 ` Euan Harris [this message]
2017-09-21 18:04 ` [PATCH v2 1/3] python: Add binding for xs_fileno() Marek Marczykowski-Górecki
2017-09-21 16:47 ` [PATCH v2 2/3] python: Extract registered watch search logic from xspy_read_watch() Euan Harris
2017-09-21 18:07 ` Marek Marczykowski-Górecki
2017-09-21 16:47 ` [PATCH v2 3/3] python: Add binding for non-blocking xs_check_watch() Euan Harris
2017-09-21 18:09 ` Marek Marczykowski-Górecki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506012428-59769-2-git-send-email-euan.harris@citrix.com \
--to=euan.harris@citrix.com \
--cc=marmarek@invisiblethingslab.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.