Skip to content

Libbpf userspace function bpf_program__attach_kprobe

0.0.4

Attach a BPF_PROG_TYPE_KPROBE program.

Definition

struct bpf_link * bpf_program__attach_kprobe(const struct bpf_program *prog, bool retprobe, const char *func_name);

Parameters

  • prog: BPF program to attach
  • retprobe: true if attaching a return probe, false if attaching an entry probe.
  • func_name: name of the kernel function to attach the probe to.

Usage

Force libbpf to attach kprobe/uprobe in specific mode, -ENOTSUP will be returned if it is not supported by the kernel.

Example

Docs could be improved

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