[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Add an ioctl interface for simple xenstore access

> Watches work in kernel space in domU (the frontends to the split device
> drivers use them), but they don't work in userspace there.  The problem is
> that there is no support in xenbus for blocking a userspace process waiting
> for a watch to fire.
> In domain 0, Xend uses a unix domain socket straight to Xenstored: it can
> block on that, as it's not going through the Xenbus kernel-level driver.

Huh?  Sleeping on the unix socket and sleeping on the /proc/xen/xenbus
filehandle should work equally well, shouldn't it?  Well, right now
there is no poll support, so you can't stuff the filehandle into
select()-loop.  But that is trivially fixable, patch below
(compile-tested only though).  Or did I miss the real problem?



Gerd 'just married' Hoffmann <kraxel@xxxxxxx>
I'm the hacker formerly known as Gerd Knorr.
diff -r f6bd46559b93 drivers/xen/xenbus/xenbus_dev.c
--- a/drivers/xen/xenbus/xenbus_dev.c   Mon Mar  6 17:57:34 2006
+++ b/drivers/xen/xenbus/xenbus_dev.c   Mon Mar 20 11:04:49 2006
@@ -36,6 +36,7 @@
 #include <linux/notifier.h>
 #include <linux/wait.h>
 #include <linux/fs.h>
+#include <linux/poll.h>
 #include "xenbus_comms.h"
@@ -208,11 +209,22 @@
        return 0;
+static unsigned int xenbus_dev_poll(struct file *file, poll_table *wait)
+       struct xenbus_dev_data *u = file->private_data;
+       poll_wait(file, &u->read_waitq, wait);
+       if (u->read_cons != u->read_prod)
+               return POLLIN | POLLRDNORM;
+       return 0;
 static struct file_operations xenbus_dev_file_ops = {
        .read = xenbus_dev_read,
        .write = xenbus_dev_write,
        .open = xenbus_dev_open,
        .release = xenbus_dev_release,
+       .poll = xenbus_dev_poll,
 static int __init
Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.