- fixed /dev/kmesg bug
This commit is contained in:
parent
be5a41ecb0
commit
f1f54b4216
@ -121,7 +121,6 @@ enum devkmsg_log_masks {
|
|||||||
#define DEVKMSG_LOG_MASK_DEFAULT 0
|
#define DEVKMSG_LOG_MASK_DEFAULT 0
|
||||||
|
|
||||||
static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
|
static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
|
||||||
static int sst_activate = 0;
|
|
||||||
|
|
||||||
static int __control_devkmsg(char *str)
|
static int __control_devkmsg(char *str)
|
||||||
{
|
{
|
||||||
@ -686,10 +685,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(buf, "test", 4) == 0) {
|
|
||||||
sst_activate = 1;
|
|
||||||
printk("Test\n");
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Extract and skip the syslog prefix <[0-9]*>. Coming from userspace
|
* Extract and skip the syslog prefix <[0-9]*>. Coming from userspace
|
||||||
* the decimal value represents 32bit, the lower 3 bit are the log
|
* the decimal value represents 32bit, the lower 3 bit are the log
|
||||||
@ -722,7 +717,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
static ssize_t devkmsg_read(struct file *file, char __user *buf,
|
static ssize_t devkmsg_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
static int cnt = 0;
|
|
||||||
struct devkmsg_user *user = file->private_data;
|
struct devkmsg_user *user = file->private_data;
|
||||||
struct printk_record *r = &user->record;
|
struct printk_record *r = &user->record;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -731,14 +725,6 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
|
|||||||
if (!user)
|
if (!user)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
|
|
||||||
if (sst_activate) {
|
|
||||||
if (cnt > 3) {
|
|
||||||
user = (struct devkmsg_user*)0x0;
|
|
||||||
} else {
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = mutex_lock_interruptible(&user->lock);
|
ret = mutex_lock_interruptible(&user->lock);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user