From 6280f190da4dd083f14f704be6b3314311a7eacb Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 23 Jun 2010 18:30:15 +0200 Subject: 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 Signed-off-by: Jeremy Fitzhardinge --- drivers/xen/xenfs/xenbus.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/xen') diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c index a9592d981b1..9d5b519d2e4 100644 --- a/drivers/xen/xenfs/xenbus.c +++ b/drivers/xen/xenfs/xenbus.c @@ -122,6 +122,9 @@ static ssize_t xenbus_file_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) -- cgit v1.2.3-18-g5258