Skip to content

Libbpf userspace function bpf_program__attach_iter

0.0.9

Attach a iterator program.

Definition

struct bpf_link * bpf_program__attach_iter(const struct bpf_program *prog, const struct bpf_iter_attach_opts *opts);

Parameters

  • prog: BPF program to attach
  • opts: options for attaching the iterator program

Return

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

struct bpf_iter_attach_opts

struct bpf_iter_attach_opts {
    size_t sz; /* size of this struct for forward/backward compatibility */
    union bpf_iter_link_info *link_info;
    __u32 link_info_len;
};
union bpf_iter_link_info {
    struct {
        __u32   map_fd;
    } map;
};

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