Commit 48c26153 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent 40aaa9b3
...@@ -33,6 +33,8 @@ static int kmsg_release(struct inode * inode, struct file * 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, static ssize_t kmsg_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) 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); return do_syslog(2, buf, count);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment