1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
4 #include <bpf/bpf_helpers.h>
6 char _license[] SEC("license") = "GPL";
11 int unique_tgid_count = 0;
14 int dump_task_file(struct bpf_iter__task_file *ctx)
16 struct seq_file *seq = ctx->meta->seq;
17 struct task_struct *task = ctx->task;
18 struct file *file = ctx->file;
21 if (task == (void *)0 || file == (void *)0)
24 if (ctx->meta->seq_num == 0) {
26 BPF_SEQ_PRINTF(seq, " tgid gid fd file\n");
29 if (tgid == task->tgid && task->tgid != task->pid)
32 if (last_tgid != task->tgid) {
33 last_tgid = task->tgid;
37 BPF_SEQ_PRINTF(seq, "%8d %8d %8d %lx\n", task->tgid, task->pid, fd,