summaryrefslogtreecommitdiff
path: root/fs/proc/kmsg.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-03-11 16:12:47 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-03-11 16:12:47 -0800
commit48c261536c971bf235544cc2aaa58fa0a18e495c (patch)
treea192d953438e5e51a1bf4d5e5021a0694b762bf7 /fs/proc/kmsg.c
parent40aaa9b3f87d0d58387af5c415ebb10406f5ad29 (diff)
[PATCH] teach /proc/kmsg about O_NONBLOCK
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.
Diffstat (limited to 'fs/proc/kmsg.c')
-rw-r--r--fs/proc/kmsg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c
index 9cfb5d6d3c5e..211b1fe2a825 100644
--- a/fs/proc/kmsg.c
+++ b/fs/proc/kmsg.c
@@ -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);
}