Skip to content

Libbpf userspace function btf__add_datasec

0.2.0

Append new BTF_KIND_DATASEC type to BTF object.

Definition

int btf__add_datasec(struct btf *btf, const char *name, __u32 byte_sz);

Parameters

  • btf: pointer to a struct btf object
  • name: name of the data section, can't be NULL or empty;
  • byte_sz: size of the data section, in bytes.

Return

>0, type ID of newly added BTF type; <0, on error.

Usage

Data section is initially empty. Variables info can be added with btf__add_datasec_var_info calls, after btf__add_datasec succeeds.

Example

Docs could be improved

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