WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / bpf_iter_task.c
blobb7f32c160f4e22978cb8a3aad1c520208dfb3aa5
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
3 #include "bpf_iter.h"
4 #include <bpf/bpf_helpers.h>
5 #include <bpf/bpf_tracing.h>
7 char _license[] SEC("license") = "GPL";
9 SEC("iter/task")
10 int dump_task(struct bpf_iter__task *ctx)
12 struct seq_file *seq = ctx->meta->seq;
13 struct task_struct *task = ctx->task;
14 static char info[] = " === END ===";
16 if (task == (void *)0) {
17 BPF_SEQ_PRINTF(seq, "%s\n", info);
18 return 0;
21 if (ctx->meta->seq_num == 0)
22 BPF_SEQ_PRINTF(seq, " tgid gid\n");
24 BPF_SEQ_PRINTF(seq, "%8d %8d\n", task->tgid, task->pid);
25 return 0;