Skip to content

Libbpf userspace function btf__new

0.0.1

Creates a new instance of a BTF object from the raw bytes of an ELF's BTF section

Definition

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

Parameters

  • data: raw bytes
  • size: number of bytes passed in data

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

Docs could be improved

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

Example

Docs could be improved

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