Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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
7char _license[] SEC("license") = "GPL";
8
9__u32 value_sum = 0;
10
11SEC("iter/bpf_map_elem")
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}