Lines Matching +full:pre +full:- +full:programs
1 .. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
4 bpftool-gen
6 -------------------------------------------------------------------------------
7 tool for BPF code-generation
8 -------------------------------------------------------------------------------
19 *OPTIONS* := { |COMMON_OPTIONS| | { **-L** | **--use-loader** } }
40 user-space object files, but in addition to combining data
60 with BPF programs from userspace side. Generated code is
70 programs, skeleton provides a storage for BPF links (**struct
72 requested, supported BPF programs will be automatically
74 user in pre-allocated fields in skeleton struct. For BPF
75 programs that can't be automatically attached by libbpf,
77 in per-program link field. All such set up links will be
80 rely on libbpf support to detach programs and free up
84 global variables of all supported kinds: mutable, read-only,
85 as well as extern ones. This interface allows to pre-setup
87 verified by kernel. For non-read-only variables, the same
94 object file are matching 1-to-1 and always stay in sync.
95 Generated code is dual-licensed under LGPL-2.1 and
96 BSD-2-Clause licenses.
102 specific maps, programs, etc.
113 - **example__open** and **example__open_opts**.
119 - **example__load**.
121 programs, initializes global data maps. It corresponds to
124 - **example__open_and_load** combines **example__open** and
128 - **example__attach** and **example__detach**
131 programs of types supported by libbpf for auto-attachment
132 will be auto-attached and their corresponding BPF links
133 instantiated. For other BPF programs, user can manually
139 - **example__destroy**
140 Detach and unload BPF programs, free up all the resources
149 Afterwards, if target kernel supports memory-mapped BPF
151 (non-read-only) data from userspace, with same simplicity
158 the corresponding maps, programs, or global variables. They
170 - **example__open(bpf_object\*)**
174 - **example__destroy()**
176 any BPF programs or maps.
181 more, given eBPF objects CO-RE relocations may be satisfied.
185 BTF files to be able to calculate CO-RE relocations.
193 together with an eBPF CO-RE based application, turning the
205 -L, --use-loader
260 This is example BPF application with two BPF programs and a mix of BPF maps
263 **$ clang -target bpf -g example1.bpf.c -o example1.bpf.o**
265 **$ clang -target bpf -g example2.bpf.c -o example2.bpf.o**
277 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
343 skel->rodata->param1 = 128;
354 printf("my_map name: %s\n", bpf_map__name(skel->maps.my_map));
356 bpf_program__fd(skel->progs.handle_sys_enter));
358 /* detach and re-attach sys_exit program */
359 bpf_link__destroy(skel->links.handle_sys_exit);
360 skel->links.handle_sys_exit =
361 bpf_program__attach(skel->progs.handle_sys_exit);
364 skel->bss->handle_sys_enter_my_static_var);
379 This is a stripped-out version of skeleton generated for above example code.
382 ------------
384 **$ bpftool btf dump file 5.4.0-example.btf format raw**
415 **$ bpftool gen min_core_btf 5.4.0-example.btf 5.4.0-smaller.btf one.bpf.o**
417 **$ bpftool btf dump file 5.4.0-smaller.btf format raw**
434 Now, the "5.4.0-smaller.btf" file may be used by libbpf as an external BTF file
435 when loading the "one.bpf.o" object into the "5.4.0-example" kernel. Note that
441 LIBBPF_OPTS(bpf_object_open_opts, opts, .btf_custom_path = "5.4.0-smaller.btf");