implement O_NONBLOCK for /proc/xen/xenbus
[linux-2.6.git] / drivers / xen / xenfs / xenbus.c
index a9592d981b107de1ca1447d1972cd4e12a3252b4..9d5b519d2e4c3ef5a3077639c3ddf4f6145f2552 100644 (file)
@@ -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)