]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] teach /proc/kmsg about O_NONBLOCK
authorAndrew Morton <akpm@osdl.org>
Fri, 12 Mar 2004 00:12:47 +0000 (16:12 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 12 Mar 2004 00:12:47 +0000 (16:12 -0800)
If there's nothing available and the file is O_NONBLOCK, return -EAGAIN.

This is a bit grubby - really we should push the file* down into do_syslog()
and handle it inside the spinlock.

fs/proc/kmsg.c

index 9cfb5d6d3c5e2b430360e004deb809539b0ebe96..211b1fe2a825621b1b6d4719635342a8aa15771b 100644 (file)
@@ -33,6 +33,8 @@ static int kmsg_release(struct inode * inode, struct file * file)
 static ssize_t kmsg_read(struct file *file, char __user *buf,
                         size_t count, loff_t *ppos)
 {
+       if ((file->f_flags & O_NONBLOCK) && !do_syslog(9, 0, 0))
+               return -EAGAIN;
        return do_syslog(2, buf, count);
 }