16879c042SYonghong Song // SPDX-License-Identifier: GPL-2.0
26879c042SYonghong Song /* Copyright (c) 2020 Facebook */
384544f56SYonghong Song #include "bpf_iter.h"
46879c042SYonghong Song #include <bpf/bpf_helpers.h>
56879c042SYonghong Song 
66879c042SYonghong Song char _license[] SEC("license") = "GPL";
76879c042SYonghong Song 
86879c042SYonghong Song SEC("iter/task")
dump_task(struct bpf_iter__task * ctx)96879c042SYonghong Song int dump_task(struct bpf_iter__task *ctx)
106879c042SYonghong Song {
116879c042SYonghong Song 	struct seq_file *seq = ctx->meta->seq;
126879c042SYonghong Song 	struct task_struct *task = ctx->task;
136879c042SYonghong Song 	int tgid;
146879c042SYonghong Song 
156879c042SYonghong Song 	tgid = task->tgid;
166879c042SYonghong Song 	bpf_seq_write(seq, &tgid, sizeof(tgid));
176879c042SYonghong Song 	return 0;
186879c042SYonghong Song }
19