Skip to content

Libbpf userspace function bpf_prog_query_opts

1.0.0

Queries the BPF programs and BPF links which are attached to target which can represent a file descriptor or netdevice ifindex.

Definition

int bpf_prog_query_opts(int target, enum bpf_attach_type type, struct bpf_prog_query_opts *opts);

Parameters

  • target: query location file descriptor or ifindex
  • type: attach type for the BPF program
  • opts: options for configuring the query

Return

0, on success; negative error code, otherwise (errno is also set to the error code)

struct bpf_prog_query_opts

struct bpf_prog_query_opts {
    size_t sz; /* size of this struct for forward/backward compatibility */
    __u32 query_flags;
    __u32 attach_flags; /* output argument */
    __u32 *prog_ids;
    union {
        /* input+output argument */
        __u32 prog_cnt;
        __u32 count;
    };
    __u32 *prog_attach_flags;
    __u32 *link_ids;
    __u32 *link_attach_flags;
    __u64 revision;
    size_t :0;
};

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