libbpf: Add bpf_link detach APIs
Add low-level bpf_link_detach() API. Also add higher-level bpf_link__detach() one. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20200731182830.286260-3-andriin@fb.com
This commit is contained in:

committed by
Alexei Starovoitov

parent
73b11c2ab0
commit
2e49527e52
@@ -603,6 +603,16 @@ int bpf_link_create(int prog_fd, int target_fd,
|
||||
return sys_bpf(BPF_LINK_CREATE, &attr, sizeof(attr));
|
||||
}
|
||||
|
||||
int bpf_link_detach(int link_fd)
|
||||
{
|
||||
union bpf_attr attr;
|
||||
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
attr.link_detach.link_fd = link_fd;
|
||||
|
||||
return sys_bpf(BPF_LINK_DETACH, &attr, sizeof(attr));
|
||||
}
|
||||
|
||||
int bpf_link_update(int link_fd, int new_prog_fd,
|
||||
const struct bpf_link_update_opts *opts)
|
||||
{
|
||||
|
Reference in New Issue
Block a user