This source file includes following definitions.
- SEC
1
2
3
4 #include <linux/bpf.h>
5 #include <stdint.h>
6 #include "bpf_helpers.h"
7
8 char _license[] SEC("license") = "GPL";
9
10 static volatile struct data {
11 char in[256];
12 char out[256];
13 } data;
14
15 enum core_reloc_primitives_enum {
16 A = 0,
17 B = 1,
18 };
19
20 struct core_reloc_primitives {
21 char a;
22 int b;
23 enum core_reloc_primitives_enum c;
24 void *d;
25 int (*f)(const char *);
26 };
27
28 SEC("raw_tracepoint/sys_enter")
29 int test_core_primitives(void *ctx)
30 {
31 struct core_reloc_primitives *in = (void *)&data.in;
32 struct core_reloc_primitives *out = (void *)&data.out;
33
34 if (BPF_CORE_READ(&out->a, &in->a) ||
35 BPF_CORE_READ(&out->b, &in->b) ||
36 BPF_CORE_READ(&out->c, &in->c) ||
37 BPF_CORE_READ(&out->d, &in->d) ||
38 BPF_CORE_READ(&out->f, &in->f))
39 return 1;
40
41 return 0;
42 }
43