From: Keir Fraser Date: Mon, 26 Jul 2010 09:40:00 +0000 (+0100) Subject: xenfs: implement O_NONBLOCK for /proc/xen/xenbus X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bf2e734daa6e940fca161d950bbad8ab947ce067;p=legacy%2Flinux-2.6.18-xen.git xenfs: implement O_NONBLOCK for /proc/xen/xenbus This patch implements O_NONBLOCK for /proc/xen/xenbus. It is a simple matter of returning -EAGAIN instead of waiting on a queue. Signed-off-by: Paolo Bonzini --- diff --git a/drivers/xen/xenbus/xenbus_dev.c b/drivers/xen/xenbus/xenbus_dev.c index 52646f19..f4b364a9 100644 --- a/drivers/xen/xenbus/xenbus_dev.c +++ b/drivers/xen/xenbus/xenbus_dev.c @@ -104,6 +104,9 @@ static ssize_t xenbus_dev_read(struct file *filp, mutex_lock(&u->reply_mutex); while (list_empty(&u->read_buffers)) { mutex_unlock(&u->reply_mutex); + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + ret = wait_event_interruptible(u->read_waitq, !list_empty(&u->read_buffers)); if (ret)