1 // SPDX-License-Identifier: GPL-2.0-only 2 3 #include "vmlinux.h" 4 #include <bpf/bpf_tracing.h> 5 #include <bpf/bpf_helpers.h> 6 7 char _license[] SEC("license") = "GPL"; 8 9 __u32 value_sum = 0; 10 11 SEC("iter/bpf_map_elem") dump_bpf_map_values(struct bpf_iter__bpf_map_elem * ctx)12int dump_bpf_map_values(struct bpf_iter__bpf_map_elem *ctx) 13 { 14 __u32 value = 0; 15 16 if (ctx->value == (void *)0) 17 return 0; 18 19 bpf_probe_read_kernel(&value, sizeof(value), ctx->value); 20 value_sum += value; 21 return 0; 22 } 23