Skip to content

Libbpf userspace function btf__new_split

1.4.0

Create a new instance of a BTF object from the provided raw data bytes. It takes another BTF instance, base_btf, which serves as a base BTF, which is extended by types in a newly created BTF instance

Definition

struct btf *btf__new_split(const void *data, __u32 size, struct btf *base_btf);

Parameters

  • data: raw bytes
  • size: length of raw bytes
  • base_btf: the base BTF object

Return

New BTF object instance which has to be eventually freed with btf__free

On error, error-code-encoded-as-pointer is returned, not a NULL. To extract error code from such a pointer libbpf_get_error should be used. If libbpf_set_strict_mode(LIBBPF_STRICT_CLEAN_PTRS) is enabled, NULL is returned on error instead. In both cases thread-local errno variable is always set to error code as well.

Usage

If base_btf is NULL, btf__new_split is equivalent to btf__new and creates non-split BTF.

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome