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