1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
4 #include <bpf/bpf_helpers.h>
5 #include <bpf/bpf_tracing.h>
7 char _license
[] SEC("license") = "GPL";
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
);
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
);