]> xenbits.xensource.com Git - people/royger/linux-2.6.18-xen.git/commitdiff
xenfs: implement O_NONBLOCK for /proc/xen/xenbus
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 26 Jul 2010 09:40:00 +0000 (10:40 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 26 Jul 2010 09:40:00 +0000 (10:40 +0100)
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 <pbonzini@redhat.com>
drivers/xen/xenbus/xenbus_dev.c

index 52646f198e8a91a661b34d32648a74e50e09681b..f4b364a9f2feea40a64f698dcb81b85f9f195b4b 100644 (file)
@@ -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)