• Home
  • Raw
  • Download

Lines Matching +full:all +full:- +full:apis

1 .. SPDX-License-Identifier: GPL-2.0
7 libbpf is a C-based library containing a BPF loader that takes compiled BPF
13 The following are the high-level features supported by libbpf:
15 * Provides high-level and low-level APIs for user space programs to interact
16 with BPF programs. The low-level APIs wrap all the bpf system call
17 functionality, which is useful when users need more fine-grained control
22 * Provides BPF-side APIS, including BPF helper definitions, BPF maps support,
24 * Supports BPF CO-RE mechanism, enabling BPF developers to write portable
32 BPF App Lifecycle and libbpf APIs
37 variables are shared between all BPF programs, which allows them to cooperate on
38 a common set of data. libbpf provides APIs that user space programs can use to
48 (setting BPF program types, if necessary; pre-setting initial values for
49 global variables, etc.) before all the entities are created and loaded.
53 the kernel. At this point, libbpf validates all the parts of a BPF application
67 destroyed, and all the resources used by the BPF app are freed.
72 BPF skeleton is an alternative interface to libbpf APIs for working with BPF
73 objects. Skeleton code abstract away generic libbpf APIs to significantly
87 * ``<name>__attach()`` – attaches all auto-attachable BPF programs (it’s
88 optional, you can have more control by using libbpf APIs directly)
89 * ``<name>__destroy()`` – detaches all BPF programs and
90 frees up all used resources
94 was possible to do with generic libbpf APIs is still possible even when the BPF
99 ---------------------------------------
108 available maps, programs, etc. BPF skeleton provides direct access to all the
110 string-based lookups with ``bpf_object_find_map_by_name()`` and
111 ``bpf_object_find_program_by_name()`` APIs, reducing errors due to BPF source
112 code and user-space code getting out of sync.
120 libbpf provides BPF-side APIs that BPF programs can use to interact with the
127 the return value, see the `bpf-helpers
128 <https://man7.org/linux/man-pages/man7/bpf-helpers.7.html>`_ man page.
130 BPF CO-RE (Compile Once – Run Everywhere)
140 libbpf steps up the BPF program portability by supporting the BPF CO-RE concept.
141 BPF CO-RE brings together BTF type information, libbpf, and the compiler to
146 running kernel. Kernel also exposes this self-describing authoritative BTF
156 The command generates a ``vmlinux.h`` header file with all kernel types
158 ``vmlinux.h`` in your BPF program eliminates dependency on system-wide kernel
164 matches all the types and fields, and updates necessary offsets and other
166 specific kernel on the host. BPF CO-RE concept thus eliminates overhead
172 ``task_struct`` using BPF CO-RE and libbf. The basic helper to read a field in a
173 CO-RE relocatable manner is ``bpf_core_read(dst, sz, src)``, which will read
177 .. code-block:: C
178 :emphasize-lines: 6
185 err = bpf_core_read(&parent_task, sizeof(void *), &task->parent);
190 /* parent_task contains the value of task->parent pointer */
204 Check out the `libbpf-bootstrap <https://github.com/libbpf/libbpf-bootstrap>`_
215 `Libbpf-rs <https://github.com/libbpf/libbpf-rs>`_ library instead of bindgen
216 bindings directly to libbpf. Libbpf-rs wraps libbpf functionality in
217 Rust-idiomatic interfaces and provides libbpf-cargo plugin to handle BPF code
218 compilation and skeleton generation. Using Libbpf-rs will make building user
228 …tps://libbpf.readthedocs.io/en/latest/libbpf_naming_convention.html#api-documentation-convention>`_