Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (c) 2020 Facebook */
0003 #include "bpf_iter.h"
0004 #include <bpf/bpf_helpers.h>
0005 
0006 char _license[] SEC("license") = "GPL";
0007 int count = 0;
0008 
0009 SEC("iter/task")
0010 int dump_task(struct bpf_iter__task *ctx)
0011 {
0012     struct seq_file *seq = ctx->meta->seq;
0013     char c;
0014 
0015     if (count < 4) {
0016         c = START_CHAR + count;
0017         bpf_seq_write(seq, &c, sizeof(c));
0018         count++;
0019     }
0020 
0021     return 0;
0022 }