multimap-btf.bpf.c 610 B

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