Debian Codegraph @

examples/uretprobe/uretprobe.c

raw symbols SCIP
1 //go:build ignore
2
3 #include "common.h"
4
5 #include "bpf_tracing.h"
6
7 char __license[] SEC("license") = "Dual MIT/GPL";
8
9 struct event {
10 u32 pid;
11 u8 line[80];
12 };
13
14 struct {
15 __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
16 __type(value, struct event);
17 } events SEC(".maps");
18
19 SEC("uretprobe/bash_readline")
20 int uretprobe_bash_readline(struct pt_regs *ctx) {
21 struct event event;
22
23 event.pid = bpf_get_current_pid_tgid();
24 bpf_probe_read(&event.line, sizeof(event.line), (void *)PT_REGS_RC(ctx));
25
26 bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU, &event, sizeof(event));
27
28 return 0;
29 }