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
13 #include <asm/segment.h>
14 #include <asm/io.h>
15
16 extern unsigned long log_size;
17 extern struct wait_queue * log_wait;
18
19 asmlinkage int sys_syslog(int type, char * bug, int count);
20
21 static int kmsg_open(struct inode * inode, struct file * file)
22 {
23 return sys_syslog(1,NULL,0);
24 }
25
26 static void kmsg_release(struct inode * inode, struct file * file)
27 {
28 (void) sys_syslog(0,NULL,0);
29 }
30
31 static int kmsg_read(struct inode * inode, struct file * file,char * buf, int count)
32 {
33 return sys_syslog(2,buf,count);
34 }
35
36 static int kmsg_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
37 {
38 if (sel_type != SEL_IN)
39 return 0;
40 if (log_size)
41 return 1;
42 select_wait(&log_wait, wait);
43 return 0;
44 }
45
46
47 static struct file_operations proc_kmsg_operations = {
48 NULL,
49 kmsg_read,
50 NULL,
51 NULL,
52 kmsg_select,
53 NULL,
54 NULL,
55 kmsg_open,
56 kmsg_release,
57 NULL
58 };
59
60 struct inode_operations proc_kmsg_inode_operations = {
61 &proc_kmsg_operations,
62 NULL,
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 };