Reputation: 147
I know this question is asked before, but I failed to find any post that has an example on how to do it. Specifically, one BPF program defines a map, and the other BPF program accesses that map. Note that it is Not one BPF program defines a map, and another userspace program accesses it. BOTH BPF program run in the kernel space.
Upvotes: 2
Views: 878
Reputation: 51
pyang.
If you don't mind using RedBPF, a rust library for eBPF, you can do what you want.
Here are the exact examples you mentioned. https://github.com/foniod/redbpf/blob/main/examples/example-userspace/examples/sharemap1.rs
and
https://github.com/foniod/redbpf/blob/main/examples/example-userspace/examples/sharemap2.rs
Upvotes: 0