Libbpf userspace function btf__add_struct
Append new BTF_KIND_STRUCT
type to BTF object.
Definition
int btf__add_struct(struct btf *btf, const char *name, __u32 sz);
Parameters
btf
: pointer to astruct btf
objectname
: name of the struct, can be NULL or empty for anonymous structs;sz
: size of the struct, in bytes;
Return
>0
, type ID of newly added BTF type; <0
, on error.
Usage
Struct initially has no fields in it. Fields can be added by btf__add_field
right after btf__add_struct
succeeds.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome