1 // SPDX-License-Identifier: GPL-2.0
7 #include <sys/resource.h>
8 #include <bpf/libbpf.h>
10 #include "trace_helpers.h"
12 int main(int ac
, char **argv
)
14 struct rlimit r
= {RLIM_INFINITY
, RLIM_INFINITY
};
15 long key
, next_key
, value
;
20 snprintf(filename
, sizeof(filename
), "%s_kern.o", argv
[0]);
21 setrlimit(RLIMIT_MEMLOCK
, &r
);
23 if (load_kallsyms()) {
24 printf("failed to process /proc/kallsyms\n");
28 if (load_bpf_file(filename
)) {
29 printf("%s", bpf_log_buf
);
33 for (i
= 0; i
< 5; i
++) {
35 printf("kprobing funcs:");
36 while (bpf_map_get_next_key(map_fd
[0], &key
, &next_key
) == 0) {
37 bpf_map_lookup_elem(map_fd
[0], &next_key
, &value
);
38 assert(next_key
== value
);
39 sym
= ksym_search(value
);
42 printf("ksym not found. Is kallsyms loaded?\n");
46 printf(" %s", sym
->name
);
51 while (bpf_map_get_next_key(map_fd
[0], &key
, &next_key
) == 0)
52 bpf_map_delete_elem(map_fd
[0], &next_key
);