| 1 | /* test-micro-loop-marker.c |
| 2 | * |
| 3 | * Execute a marker in a loop |
| 4 | */ |
| 5 | |
| 6 | #include <linux/marker.h> |
| 7 | #include <linux/module.h> |
| 8 | #include <linux/proc_fs.h> |
| 9 | #include <linux/sched.h> |
| 10 | #include <asm/ptrace.h> |
| 11 | #include <linux/timex.h> |
| 12 | #include <linux/string.h> |
| 13 | |
| 14 | #define NR_LOOPS 10000 |
| 15 | |
| 16 | |
| 17 | #define COPYLEN 4096 |
| 18 | char test[COPYLEN]; |
| 19 | char src[COPYLEN] = "aaaaaaaaaaaa"; |
| 20 | |
| 21 | struct proc_dir_entry *pentry = NULL; |
| 22 | |
| 23 | static int my_open(struct inode *inode, struct file *file) |
| 24 | { |
| 25 | MARK(subsys_mark1, "%d %p", 1, NULL); |
| 26 | |
| 27 | return -EPERM; |
| 28 | } |
| 29 | |
| 30 | |
| 31 | static struct file_operations my_operations = { |
| 32 | .open = my_open, |
| 33 | }; |
| 34 | |
| 35 | int init_module(void) |
| 36 | { |
| 37 | pentry = create_proc_entry("testmark", 0444, NULL); |
| 38 | if (pentry) |
| 39 | pentry->proc_fops = &my_operations; |
| 40 | |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | void cleanup_module(void) |
| 45 | { |
| 46 | remove_proc_entry("testmark", NULL); |
| 47 | } |
| 48 | |
| 49 | MODULE_LICENSE("GPL"); |
| 50 | MODULE_AUTHOR("Mathieu Desnoyers"); |
| 51 | MODULE_DESCRIPTION("Marker Test"); |
| 52 | |