]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/bpf-foreign.c
core: add bpf-foreign unit helpers
authorJulia Kartseva <hex@fb.com>
Wed, 16 Sep 2020 22:58:04 +0000 (15:58 -0700)
committerJulia Kartseva <hex@fb.com>
Sat, 10 Apr 2021 03:28:47 +0000 (20:28 -0700)
commit5f8ba20d7f15b2d8b7d2596a1125412047b4e995
tree02475585c3a740c4369e133903c464385136eece
parentb894ef1b712433e07cd5f11b8f84dfaa0ce5a4ef
core: add bpf-foreign unit helpers

- Introduce support of cgroup-bpf programs managed (i.e. compiled,
loaded to and unloaded from kernel) externally. Systemd is only
responsible for attaching programs to unit cgroup hence the name
'foreign'.

Foreign BPF programs are identified by bpf program ID and attach type.

systemd:
- Gets kernel FD of BPF program;
- Makes a unique identifier of BPF program from BPF attach type and
program ID. Same program IDs mean the same program, i.e the same
chunk of kernel memory. Even if the same program is passed multiple
times, identical (program_id, attach_type) instances are collapsed
into one;
- Attaches programs to unit cgroup.
src/core/bpf-foreign.c [new file with mode: 0644]
src/core/bpf-foreign.h [new file with mode: 0644]
src/core/meson.build
src/core/unit.c
src/core/unit.h