4
0

text_64_64_reloc.c 544 B

12345678910111213141516171819202122232425
  1. // clang-format off
  2. #include <vmlinux.h>
  3. #include <bpf/bpf_helpers.h>
  4. // clang-format on
  5. char _license[] SEC("license") = "GPL";
  6. struct {
  7. __uint(type, BPF_MAP_TYPE_ARRAY);
  8. __type(key, __u32);
  9. __type(value, __u64);
  10. __uint(max_entries, 2);
  11. } RESULTS SEC(".maps");
  12. static __u64 inc_cb(void *map, __u32 *key, void *val, void *data) {
  13. __u64 *value = val;
  14. *value += 1;
  15. return 0;
  16. }
  17. SEC("uprobe/test_text_64_64_reloc")
  18. int test_text_64_64_reloc(struct pt_regs *ctx) {
  19. bpf_for_each_map_elem(&RESULTS, inc_cb, NULL, 0);
  20. return 0;
  21. }