Skip to content

Libbpf userspace function btf__add_func

0.2.0

Append new BTF_KIND_FUNC type to BTF object.

Definition

int btf__add_func(struct btf *btf, const char *name, enum btf_func_linkage linkage, int proto_type_id);

Parameters

  • btf: pointer to a struct btf object
  • name: name of the function, can't be NULL or empty;
  • linkage: linkage type of the function;
  • proto_type_id: FUNC_PROTO's type ID, it might not exist yet;

Return

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

enum btf_func_linkage

enum btf_func_linkage {
    BTF_FUNC_STATIC = 0,
    BTF_FUNC_GLOBAL = 1,
    BTF_FUNC_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