On Mon, Mar 4, 2019 at 10:45 PM Kanthi P <pavuluri.kan...@gmail.com> wrote: > > Thanks for that! > > I think those work because bcc has given utilities to do that. > > I am using C and we use libbpf to load programs and to do map operations. > > Do you know if we can achieve it in this way too?
You should be able to do the work with C as well. Just use APIs from libbpf.h, e.g., bpf_prog_get_next_id, bpf_prog_get_fd_by_id, bpf_map_get_fd_by_id. Yes, we may miss bpf_map_get_next_id and bpf_obj_get_info_by_fd. You can just add prototype to bcc/src/cc/libbpf.h and the implementation is libbpf submodule. We can add the missing piece in bcc/src/cc/{libbpf.h, libbpf.c}. > > Thanks, > Kanthi > > On Tue, Mar 5, 2019 at 2:21 AM Y Song <ys114...@gmail.com> wrote: >> >> On Mon, Mar 4, 2019 at 9:52 AM Kanthi P <pavuluri.kan...@gmail.com> wrote: >> > >> > Hi, >> > >> > I have two eBPF programs, each with its own user and kernel programs. >> > >> > One of the programs defines an eBPF map. >> > >> > How do I access this map from another eBPF kernel program? >> >> In examples/cpp, we have UseExternalMap.cc, which gives an example of >> how to share maps between two processes with C++ interface. >> Basically, if you know the ID of the map in another application (you >> can see id use bpftool), you can get a fd for that map by ID with API >> `bpf_map_get_fd_by_id()`, and example shows how to inject the new `fd` >> to bcc compilation system. >> >> We do not have a python way to share map yet bwtween two different processes. >> >> Please take a look. If you feel the interface needs to improve to >> support your use case, we can do that. >> >> > >> > PS: >> > >> > I can pin the map and that helps me access this map from other program's >> > user space. >> > But looking for a direct way in which I can access this map from other >> > programs's kernel space. >> > >> > Thanks! >> > -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#1599): https://lists.iovisor.org/g/iovisor-dev/message/1599 Mute This Topic: https://lists.iovisor.org/mt/30216635/21656 Group Owner: iovisor-dev+ow...@lists.iovisor.org Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-