From bf2e734daa6e940fca161d950bbad8ab947ce067 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 26 Jul 2010 10:40:00 +0100 Subject: [PATCH] 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 --- drivers/xen/xenbus/xenbus_dev.c | 3 +++ 1 file changed, 3 insertions(+) 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) -- 2.39.5