Skip to content

Libbpf userspace function bpf_program__attach_uprobe

0.0.4

Attaches a BPF program to the userspace function which is found by binary path and offset. You can optionally specify a particular process to attach to. You can also optionally attach the program to the function exit instead of entry.

Definition

struct bpf_link * bpf_program__attach_uprobe(const struct bpf_program *prog, bool retprobe, pid_t pid, const char *binary_path, size_t func_offset);

Parameters

  • prog: BPF program to attach
  • retprobe: Attach to function exit
  • pid: Process ID to attach the uprobe to, 0 for self (own process), -1 for all processes
  • binary_path: Path to binary that contains the function symbol
  • func_offset: Offset within the binary of the function symbol

Return

Reference to the newly created BPF link; or NULL is returned on error, error code is stored in errno

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