mon_stat.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) mon_stat.c (5b1c674d223eef6c6494be8be91e9e3a3054817e)
1/*
2 * The USB Monitor, inspired by Dave Harding's USBMon.
3 *
4 * This is the 's' or 'stat' reader which debugs usbmon itself.
5 * Note that this code blows through locks, so make sure that
6 * /dbg/usbmon/0s is well protected from non-root users.
7 *
8 */

--- 17 unchanged lines hidden (view full) ---

26 struct snap *sp;
27
28 if ((sp = kmalloc(sizeof(struct snap), GFP_KERNEL)) == NULL)
29 return -ENOMEM;
30
31 mbus = inode->u.generic_ip;
32
33 sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
1/*
2 * The USB Monitor, inspired by Dave Harding's USBMon.
3 *
4 * This is the 's' or 'stat' reader which debugs usbmon itself.
5 * Note that this code blows through locks, so make sure that
6 * /dbg/usbmon/0s is well protected from non-root users.
7 *
8 */

--- 17 unchanged lines hidden (view full) ---

26 struct snap *sp;
27
28 if ((sp = kmalloc(sizeof(struct snap), GFP_KERNEL)) == NULL)
29 return -ENOMEM;
30
31 mbus = inode->u.generic_ip;
32
33 sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
34 "nreaders %d text_lost %u\n",
35 mbus->nreaders, mbus->cnt_text_lost);
34 "nreaders %d events %u text_lost %u\n",
35 mbus->nreaders, mbus->cnt_events, mbus->cnt_text_lost);
36
37 file->private_data = sp;
38 return 0;
39}
40
41static ssize_t mon_stat_read(struct file *file, char __user *buf,
42 size_t nbytes, loff_t *ppos)
43{

--- 31 unchanged lines hidden ---
36
37 file->private_data = sp;
38 return 0;
39}
40
41static ssize_t mon_stat_read(struct file *file, char __user *buf,
42 size_t nbytes, loff_t *ppos)
43{

--- 31 unchanged lines hidden ---