multimap-btf.bpf.c 656 B

123456789101112131415161718192021222324252627282930
  1. // clang-format off
  2. #include <linux/bpf.h>
  3. #include <bpf/bpf_helpers.h>
  4. // clang-format on
  5. struct {
  6. __uint(type, BPF_MAP_TYPE_ARRAY);
  7. __type(key, __u32);
  8. __type(value, __u64);
  9. __uint(max_entries, 1);
  10. } map_1 SEC(".maps");
  11. struct {
  12. __uint(type, BPF_MAP_TYPE_ARRAY);
  13. __type(key, __u32);
  14. __type(value, __u64);
  15. __uint(max_entries, 1);
  16. } map_2 SEC(".maps");
  17. SEC("tracepoint")
  18. int bpf_prog(void *ctx) {
  19. __u32 key = 0;
  20. __u64 twenty_four = 24;
  21. __u64 forty_two = 42;
  22. bpf_map_update_elem(&map_1, &key, &twenty_four, BPF_ANY);
  23. bpf_map_update_elem(&map_2, &key, &forty_two, BPF_ANY);
  24. return 0;
  25. }
  26. char _license[] SEC("license") = "GPL";