f8e77313 |
1 | /* test-mark.c |
2 | * |
3 | */ |
4 | |
5 | #include <linux/marker.h> |
6 | #include <linux/module.h> |
7 | #include <linux/proc_fs.h> |
8 | #include <linux/sched.h> |
9576ead5 |
9 | #include <asm/ptrace.h> |
f8e77313 |
10 | |
abfc2016 |
11 | volatile int x=7; |
f8e77313 |
12 | |
13 | struct proc_dir_entry *pentry = NULL; |
14 | |
9576ead5 |
15 | static inline void test(struct pt_regs * regs) |
16 | { |
17 | MARK(kernel_debug_test, "%d %ld %p", 2, regs->eip, regs); |
18 | } |
19 | |
f8e77313 |
20 | static int my_open(struct inode *inode, struct file *file) |
21 | { |
abfc2016 |
22 | unsigned int i; |
23 | |
24 | for(i=0; i<2; i++) { |
25 | MARK(subsys_mark1, "%d", 1); |
26 | x=i; |
27 | barrier(); |
28 | } |
f8e77313 |
29 | MARK(subsys_mark2, "%d %s", 2, "blah2"); |
abfc2016 |
30 | MARK(subsys_mark3, "%d %s %s", x, "blah3", "blah5"); |
9576ead5 |
31 | test(NULL); |
32 | test(NULL); |
f8e77313 |
33 | |
34 | return -EPERM; |
35 | } |
36 | |
37 | |
38 | static struct file_operations my_operations = { |
7c26985b |
39 | .open = my_open, |
f8e77313 |
40 | }; |
41 | |
42 | int init_module(void) |
43 | { |
9576ead5 |
44 | unsigned int i; |
45 | |
7c26985b |
46 | pentry = create_proc_entry("testmark", 0444, NULL); |
47 | if (pentry) |
48 | pentry->proc_fops = &my_operations; |
9576ead5 |
49 | |
50 | marker_list_probe(NULL); |
51 | |
f8e77313 |
52 | return 0; |
53 | } |
54 | |
55 | void cleanup_module(void) |
56 | { |
57 | remove_proc_entry("testmark", NULL); |
58 | } |
59 | |
60 | MODULE_LICENSE("GPL"); |
61 | MODULE_AUTHOR("Mathieu Desnoyers"); |
62 | MODULE_DESCRIPTION("Marker Test"); |
63 | |