Libbpf userspace function btf__add_var
Append new BTF_KIND_VAR
type to BTF object.
Definition
int btf__add_var(struct btf *btf, const char *name, int linkage, int type_id);
Parameters
btf
: pointer to astruct btf
objectname
: name of the variable, can't beNULL
or empty;linkage
: linkage type of the variable;
Return
>0
, type ID of newly added BTF type; <0
, on error.
enum btf_var_linkage
enum {
BTF_VAR_STATIC = 0,
BTF_VAR_GLOBAL_ALLOCATED = 1,
BTF_VAR_GLOBAL_EXTERN = 2,
};
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