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 int count = 0; 86879c042SYonghong Song 96879c042SYonghong Song SEC("iter/task") dump_task(struct bpf_iter__task * ctx)106879c042SYonghong Songint dump_task(struct bpf_iter__task *ctx) 116879c042SYonghong Song { 126879c042SYonghong Song struct seq_file *seq = ctx->meta->seq; 136879c042SYonghong Song char c; 146879c042SYonghong Song 156879c042SYonghong Song if (count < 4) { 166879c042SYonghong Song c = START_CHAR + count; 176879c042SYonghong Song bpf_seq_write(seq, &c, sizeof(c)); 186879c042SYonghong Song count++; 196879c042SYonghong Song } 206879c042SYonghong Song 216879c042SYonghong Song return 0; 226879c042SYonghong Song } 23