Skip to content

Libbpf userspace function btf__add_decl_attr

1.6.0

Append new BTF_KIND_DECL_TAG type to BTF object.

Definition

int btf__add_decl_attr(struct btf *btf, const char *value, int ref_type_id, int component_idx);

Parameters

  • btf: pointer to a struct btf object
  • value: tag value, can't be NULL or empty;
  • ref_type_id: referenced type ID, it might not exist yet;
  • component_idx: -1 for tagging reference type, otherwise struct/union member or function argument index;

Return

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

Usage

Sets info->kflag to 1, indicating this tag is an __attribute__

Example

Docs could be improved

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