1 // SPDX-License-Identifier: GPL-2.0
7 #include <sys/resource.h>
11 int main(int ac
, char **argv
)
13 struct rlimit r
= {RLIM_INFINITY
, RLIM_INFINITY
};
14 long key
, next_key
, value
;
19 snprintf(filename
, sizeof(filename
), "%s_kern.o", argv
[0]);
20 setrlimit(RLIMIT_MEMLOCK
, &r
);
22 if (load_kallsyms()) {
23 printf("failed to process /proc/kallsyms\n");
27 if (load_bpf_file(filename
)) {
28 printf("%s", bpf_log_buf
);
32 for (i
= 0; i
< 5; i
++) {
34 printf("kprobing funcs:");
35 while (bpf_map_get_next_key(map_fd
[0], &key
, &next_key
) == 0) {
36 bpf_map_lookup_elem(map_fd
[0], &next_key
, &value
);
37 assert(next_key
== value
);
38 sym
= ksym_search(value
);
39 printf(" %s", sym
->name
);
45 while (bpf_map_get_next_key(map_fd
[0], &key
, &next_key
) == 0)
46 bpf_map_delete_elem(map_fd
[0], &next_key
);