bc82195a |
1 | /* probe.c |
2 | * |
3 | * Loads a function at a marker call site. |
4 | * |
5 | * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
6 | * |
7 | * This file is released under the GPLv2. |
8 | * See the file COPYING for more details. |
9 | */ |
10 | |
11 | #include <linux/marker.h> |
12 | #include <linux/module.h> |
13 | #include <linux/kallsyms.h> |
14 | |
15 | /* function to install */ |
16 | #define DO_MARK1_FORMAT "%d %p" |
17 | void do_mark1(const char *format, ...) |
18 | { |
19 | #if 0 |
20 | va_list ap; |
21 | int value; |
22 | |
23 | va_start(ap, format); |
24 | value = va_arg(ap, int); |
25 | printk("value is %d\n", value); |
26 | |
27 | va_end(ap); |
28 | #endif //0 |
29 | } |
30 | |
31 | int init_module(void) |
32 | { |
33 | int result; |
34 | result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT, |
35 | (marker_probe_func*)do_mark1); |
36 | if(!result) goto end; |
37 | |
38 | return 0; |
39 | |
40 | end: |
41 | marker_remove_probe(do_mark1); |
42 | return -EPERM; |
43 | } |
44 | |
45 | void cleanup_module(void) |
46 | { |
47 | marker_remove_probe(do_mark1); |
48 | } |
49 | |
50 | MODULE_LICENSE("GPL"); |
51 | MODULE_AUTHOR("Mathieu Desnoyers"); |
52 | MODULE_DESCRIPTION("Probe"); |