diff options
author | Kui-Feng Lee <kuifeng@fb.com> | 2022-09-26 11:49:56 -0700 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2022-09-28 16:30:03 -0700 |
commit | b3e1331eb925a45df1cc5d02a725e5ea70da0e2e (patch) | |
tree | fabc71d53ef9ba11a14bdc8a5a8395ade410299f /tools/testing/selftests/bpf/progs/bpf_iter_task.c | |
parent | 2c4fe44fb020f3cce904da2ba9e42bb1c118e8a3 (diff) | |
download | linux-b3e1331eb925a45df1cc5d02a725e5ea70da0e2e.tar.gz linux-b3e1331eb925a45df1cc5d02a725e5ea70da0e2e.tar.bz2 linux-b3e1331eb925a45df1cc5d02a725e5ea70da0e2e.zip |
selftests/bpf: Test parameterized task BPF iterators.
Test iterators of vma, files and tasks.
Ensure the API works appropriately to visit all tasks,
tasks in a process, or a particular task.
Signed-off-by: Kui-Feng Lee <kuifeng@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/bpf/20220926184957.208194-5-kuifeng@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_iter_task.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/bpf_iter_task.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_task.c b/tools/testing/selftests/bpf/progs/bpf_iter_task.c index d22741272692..96131b9a1caa 100644 --- a/tools/testing/selftests/bpf/progs/bpf_iter_task.c +++ b/tools/testing/selftests/bpf/progs/bpf_iter_task.c @@ -6,6 +6,10 @@ char _license[] SEC("license") = "GPL"; +uint32_t tid = 0; +int num_unknown_tid = 0; +int num_known_tid = 0; + SEC("iter/task") int dump_task(struct bpf_iter__task *ctx) { @@ -18,6 +22,11 @@ int dump_task(struct bpf_iter__task *ctx) return 0; } + if (task->pid != tid) + num_unknown_tid++; + else + num_known_tid++; + if (ctx->meta->seq_num == 0) BPF_SEQ_PRINTF(seq, " tgid gid\n"); |