This source file includes following definitions.
- kmsg_open
- kmsg_release
- kmsg_read
- kmsg_select
1
2
3
4
5
6
7
8 #include <linux/types.h>
9 #include <linux/errno.h>
10 #include <linux/sched.h>
11 #include <linux/kernel.h>
12 #include <linux/tty.h>
13
14 #include <asm/segment.h>
15 #include <asm/io.h>
16
17 extern unsigned long log_size;
18 extern struct wait_queue * log_wait;
19
20 extern int sys_syslog(int type, char * bug, int count);
21
22 static int kmsg_open(struct inode * inode, struct file * file)
23 {
24 return sys_syslog(1,NULL,0);
25 }
26
27 static void kmsg_release(struct inode * inode, struct file * file)
28 {
29 (void) sys_syslog(0,NULL,0);
30 }
31
32 static int kmsg_read(struct inode * inode, struct file * file,char * buf, int count)
33 {
34 return sys_syslog(2,buf,count);
35 }
36
37 static int kmsg_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
38 {
39 if (sel_type != SEL_IN)
40 return 0;
41 if (log_size)
42 return 1;
43 select_wait(&log_wait, wait);
44 return 0;
45 }
46
47
48 static struct file_operations proc_kmsg_operations = {
49 NULL,
50 kmsg_read,
51 NULL,
52 NULL,
53 kmsg_select,
54 NULL,
55 NULL,
56 kmsg_open,
57 kmsg_release,
58 NULL
59 };
60
61 struct inode_operations proc_kmsg_inode_operations = {
62 &proc_kmsg_operations,
63 NULL,
64 NULL,
65 NULL,
66 NULL,
67 NULL,
68 NULL,
69 NULL,
70 NULL,
71 NULL,
72 NULL,
73 NULL,
74 NULL,
75 NULL,
76 NULL
77 };