Libbpf userspace function bpf_program__attach_uprobe
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 attachretprobe
: Attach to function exitpid
: Process ID to attach the uprobe to, 0 for self (own process),-1
for all processesbinary_path
: Path to binary that contains the function symbolfunc_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