Libbpf userspace function bpf_program__attach_raw_tracepoint_opts
Attach a BPF_PROG_TYPE_RAW_TRACEPOINT
program. Like bpf_program__attach_raw_tracepoint
, but with additional options.
Definition
struct bpf_link * bpf_program__attach_raw_tracepoint_opts(const struct bpf_program *prog, const char *tp_name, struct bpf_raw_tracepoint_opts *opts);
Parameters
prog
: BPF program to attachtp_name
: Tracepoint nameopts
: Tracepoint options
Return
Reference to the newly created BPF link; or NULL
is returned on error, error code is stored in errno
struct bpf_raw_tracepoint_opts
struct bpf_raw_tracepoint_opts {
size_t sz; /* size of this struct for forward/backward compatibility */
__u64 cookie;
size_t :0;
};
cookie
Custom user-provided value fetchable through bpf_get_attach_cookie
. This allows you to write one program, load it once, and then attach it to multiple perf events with different bpf_cookie
values, allowing the program to detect which event it is attached to.
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