From: Andrew Morton Date: Fri, 12 Mar 2004 00:12:47 +0000 (-0800) Subject: [PATCH] teach /proc/kmsg about O_NONBLOCK X-Git-Tag: v2.6.5-rc1~48^2~2^2~75 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=48c261536c971bf235544cc2aaa58fa0a18e495c;p=history.git [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. --- 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); }