blob: 9192d3f2e4a5617f1fb3d18fbdc8d65b93d59c38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#define STP_NETLINK_ONLY
#define STP_NUM_STRINGS 1
#include "runtime.h"
#include "probes.c"
MODULE_DESCRIPTION("SystemTap probe: bench");
MODULE_AUTHOR("Martin Hunt");
asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
{
jprobe_return();
return 0;
}
static int inst_sys_read (struct kprobe *p, struct pt_regs *regs)
{
return 0;
}
static struct jprobe jp[] = {
{
.kp.addr = (kprobe_opcode_t *)"sys_write",
.entry = (kprobe_opcode_t *) inst_sys_write
},
};
static struct kprobe kp[] = {
{
.addr = "sys_read",
.pre_handler = inst_sys_read
}
};
#define NUM_JPROBES (sizeof(jp)/sizeof(struct jprobe))
#define NUM_KPROBES (sizeof(kp)/sizeof(struct kprobe))
int init_module(void)
{
int ret;
TRANSPORT_OPEN;
ret = _stp_register_jprobes (jp, NUM_JPROBES);
if (ret >= 0)
ret = _stp_register_kprobes (kp, NUM_KPROBES);
return ret;
}
static void probe_exit (void)
{
_stp_unregister_jprobes (jp, NUM_JPROBES);
_stp_unregister_kprobes (kp, NUM_KPROBES);
}
void cleanup_module(void)
{
_stp_transport_close();
}
MODULE_LICENSE("GPL");
|