Skip to content

Libbpf userspace function btf__add_int

0.2.0

Append new BTF_KIND_INT type to the BTF object.

Definition

int btf__add_int(struct btf *btf, const char *name, size_t byte_sz, int encoding);

Parameters

  • btf: pointer to a struct btf object
  • name: name of the type; non-empty, non-NULL type name;
  • byte_sz: power-of-2 (1, 2, 4, ..) size of the type, in bytes;
  • encoding: combination of BTF_INT_SIGNED, BTF_INT_CHAR, BTF_INT_BOOL.
/* Attributes stored in the BTF_INT_ENCODING */
#define BTF_INT_SIGNED  (1 << 0)
#define BTF_INT_CHAR    (1 << 1)
#define BTF_INT_BOOL    (1 << 2)

Return

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

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