mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-02 22:59:07 +08:00
libbpf: Add support for associating BPF program with struct_ops
Add low-level wrapper and libbpf API for BPF_PROG_ASSOC_STRUCT_OPS command in the bpf() syscall. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20251203233748.668365-4-ameryhung@gmail.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
1a41b12b4f
commit
5635185147
16
src/libbpf.h
16
src/libbpf.h
@@ -1006,6 +1006,22 @@ LIBBPF_API int
|
||||
bpf_program__set_attach_target(struct bpf_program *prog, int attach_prog_fd,
|
||||
const char *attach_func_name);
|
||||
|
||||
struct bpf_prog_assoc_struct_ops_opts; /* defined in bpf.h */
|
||||
|
||||
/**
|
||||
* @brief **bpf_program__assoc_struct_ops()** associates a BPF program with a
|
||||
* struct_ops map.
|
||||
*
|
||||
* @param prog BPF program
|
||||
* @param map struct_ops map to be associated with the BPF program
|
||||
* @param opts optional options, can be NULL
|
||||
*
|
||||
* @return 0, on success; negative error code, otherwise
|
||||
*/
|
||||
LIBBPF_API int
|
||||
bpf_program__assoc_struct_ops(struct bpf_program *prog, struct bpf_map *map,
|
||||
struct bpf_prog_assoc_struct_ops_opts *opts);
|
||||
|
||||
/**
|
||||
* @brief **bpf_object__find_map_by_name()** returns BPF map of
|
||||
* the given name, if it exists within the passed BPF object
|
||||
|
||||
Reference in New Issue
Block a user