1254794Sdumbbell// SPDX-License-Identifier: GPL-2.0 2254794Sdumbbell/* Copyright (c) 2020 Facebook */ 3254794Sdumbbell#include "bpf_iter.h" 4254794Sdumbbell#include <bpf/bpf_helpers.h> 5254794Sdumbbell 6254794Sdumbbellchar _license[] SEC("license") = "GPL"; 7254794Sdumbbell 8254794SdumbbellSEC("iter/task") 9254794Sdumbbellint dump_task(struct bpf_iter__task *ctx) 10254794Sdumbbell{ 11254794Sdumbbell struct seq_file *seq = ctx->meta->seq; 12254794Sdumbbell struct task_struct *task = ctx->task; 13254794Sdumbbell int tgid; 14254794Sdumbbell 15254794Sdumbbell tgid = task->tgid; 16254794Sdumbbell bpf_seq_write(seq, &tgid, sizeof(tgid)); 17254794Sdumbbell return 0; 18254794Sdumbbell} 19254794Sdumbbell