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 | |
16 | int value; |
17 | void *ptr; |
18 | |
19 | /* function to install */ |
20 | #define DO_MARK1_FORMAT "%d %p" |
21 | void do_mark1(const char *format, ...) |
22 | { |
23 | va_list ap; |
24 | |
25 | va_start(ap, format); |
26 | value = va_arg(ap, int); |
27 | ptr = va_arg(ap, void*); |
28 | |
29 | va_end(ap); |
30 | } |
31 | |
32 | int init_module(void) |
33 | { |
34 | int result; |
35 | result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT, |
36 | (marker_probe_func*)do_mark1); |
37 | if(!result) goto end; |
38 | |
39 | return 0; |
40 | |
41 | end: |
42 | marker_remove_probe(do_mark1); |
43 | return -EPERM; |
44 | } |
45 | |
46 | void cleanup_module(void) |
47 | { |
48 | marker_remove_probe(do_mark1); |
49 | } |
50 | |
51 | MODULE_LICENSE("GPL"); |
52 | MODULE_AUTHOR("Mathieu Desnoyers"); |
53 | MODULE_DESCRIPTION("Probe"); |