6 #include <sys/resource.h>
10 int main(int ac
, char **argv
)
12 struct rlimit r
= {RLIM_INFINITY
, RLIM_INFINITY
};
13 long key
, next_key
, value
;
18 snprintf(filename
, sizeof(filename
), "%s_kern.o", argv
[0]);
19 setrlimit(RLIMIT_MEMLOCK
, &r
);
21 if (load_kallsyms()) {
22 printf("failed to process /proc/kallsyms\n");
26 if (load_bpf_file(filename
)) {
27 printf("%s", bpf_log_buf
);
31 for (i
= 0; i
< 5; i
++) {
33 printf("kprobing funcs:");
34 while (bpf_map_get_next_key(map_fd
[0], &key
, &next_key
) == 0) {
35 bpf_map_lookup_elem(map_fd
[0], &next_key
, &value
);
36 assert(next_key
== value
);
37 sym
= ksym_search(value
);
38 printf(" %s", sym
->name
);
44 while (bpf_map_get_next_key(map_fd
[0], &key
, &next_key
) == 0)
45 bpf_map_delete_elem(map_fd
[0], &next_key
);