diff options
| author | Kui-Feng Lee <thinker.li@gmail.com> | 2024-05-29 23:59:43 -0700 |
|---|---|---|
| committer | Martin KaFai Lau <martin.lau@kernel.org> | 2024-05-30 15:34:14 -0700 |
| commit | 1a4b858b6a045828de1b536cfab7819c50864ed6 (patch) | |
| tree | f53330aaf10aa8fd2acce185f5fc2745fe236e3c /tools/testing/selftests/bpf/progs/struct_ops_detach.c | |
| parent | bpf: export bpf_link_inc_not_zero. (diff) | |
| download | linux-1a4b858b6a045828de1b536cfab7819c50864ed6.tar.gz linux-1a4b858b6a045828de1b536cfab7819c50864ed6.zip | |
selftests/bpf: test struct_ops with epoll
Verify whether a user space program is informed through epoll with EPOLLHUP
when a struct_ops object is detached.
The BPF code in selftests/bpf/progs/struct_ops_module.c has become
complex. Therefore, struct_ops_detach.c has been added to segregate the BPF
code for detachment tests from the BPF code for other tests based on the
recommendation of Andrii Nakryiko.
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Link: https://lore.kernel.org/r/20240530065946.979330-6-thinker.li@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/struct_ops_detach.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/struct_ops_detach.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/struct_ops_detach.c b/tools/testing/selftests/bpf/progs/struct_ops_detach.c new file mode 100644 index 000000000000..56b787a89876 --- /dev/null +++ b/tools/testing/selftests/bpf/progs/struct_ops_detach.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ +#include <vmlinux.h> +#include <bpf/bpf_helpers.h> +#include "../bpf_testmod/bpf_testmod.h" + +char _license[] SEC("license") = "GPL"; + +SEC(".struct_ops.link") +struct bpf_testmod_ops testmod_do_detach; |
