Libbpf userspace function bpf_btf_load
Low level wrapper around the BPF_BTF_LOAD
syscall command.
Definition
int bpf_btf_load(const void *btf_data, size_t btf_size, struct bpf_btf_load_opts *opts);
Parameters
btf_data
: pointer to the BTF data to loadbtf_size
: size of the BTF dataopts
: options for the BTF load
struct bpf_btf_load_opts
struct bpf_btf_load_opts {
size_t sz; /* size of this struct for forward/backward compatibility */
/* kernel log options */
char *log_buf;
__u32 log_level;
__u32 log_size;
/* output: actual total log contents size (including terminating zero).
* It could be both larger than original log_size (if log was
* truncated), or smaller (if log buffer wasn't filled completely).
* If kernel doesn't support this feature, log_size is left unchanged.
*/
__u32 log_true_size;
__u32 btf_flags;
__u32 token_fd;
size_t :0;
};
log_buf
log_level
log_size
log_true_size
btf_flags
token_fd
Usage
This function should only be used if you need precise control over the BTF loading process. For most cases, program should be loaded via bpf_object__load
or similar high level APIs instead.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome