diff options
author | Alexei Starovoitov <ast@fb.com> | 2017-10-02 22:50:24 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-04 16:05:05 -0700 |
commit | 244d20efdb68c5c1a26c667baeb232ea163e2f69 (patch) | |
tree | ddf239fde7d79e9c383edf3fa7aa8877c227359a /tools/lib/bpf/bpf.c | |
parent | 390ee7e29fc8e6e90d3065b00afb047c4ee552f9 (diff) | |
download | linux-244d20efdb68c5c1a26c667baeb232ea163e2f69.tar.bz2 |
libbpf: introduce bpf_prog_detach2()
introduce bpf_prog_detach2() that takes one more argument prog_fd
vs bpf_prog_detach() that takes only attach_fd and type.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/lib/bpf/bpf.c')
-rw-r--r-- | tools/lib/bpf/bpf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index daf624e4c720..d4b6ba8292ee 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -291,6 +291,18 @@ int bpf_prog_detach(int target_fd, enum bpf_attach_type type) return sys_bpf(BPF_PROG_DETACH, &attr, sizeof(attr)); } +int bpf_prog_detach2(int prog_fd, int target_fd, enum bpf_attach_type type) +{ + union bpf_attr attr; + + bzero(&attr, sizeof(attr)); + attr.target_fd = target_fd; + attr.attach_bpf_fd = prog_fd; + attr.attach_type = type; + + return sys_bpf(BPF_PROG_DETACH, &attr, sizeof(attr)); +} + int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size, void *data_out, __u32 *size_out, __u32 *retval, __u32 *duration) |