Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.16 25 lines 572 B view raw
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2020 Facebook */ 3#include "bpf_iter.h" 4#include <bpf/bpf_helpers.h> 5 6char _license[] SEC("license") = "GPL"; 7 8SEC("iter/task") 9int dump_task(struct bpf_iter__task *ctx) 10{ 11 struct seq_file *seq = ctx->meta->seq; 12 struct task_struct *task = ctx->task; 13 static char info[] = " === END ==="; 14 15 if (task == (void *)0) { 16 BPF_SEQ_PRINTF(seq, "%s\n", info); 17 return 0; 18 } 19 20 if (ctx->meta->seq_num == 0) 21 BPF_SEQ_PRINTF(seq, " tgid gid\n"); 22 23 BPF_SEQ_PRINTF(seq, "%8d %8d\n", task->tgid, task->pid); 24 return 0; 25}