]> Git Repo - linux.git/blob - tools/testing/selftests/bpf/progs/loop2.c
Linux 6.14-rc3
[linux.git] / tools / testing / selftests / bpf / progs / loop2.c
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
3 #include <linux/sched.h>
4 #include <linux/ptrace.h>
5 #include <stdint.h>
6 #include <stddef.h>
7 #include <stdbool.h>
8 #include <linux/bpf.h>
9 #include <bpf/bpf_helpers.h>
10 #include <bpf/bpf_tracing.h>
11
12 char _license[] SEC("license") = "GPL";
13
14 SEC("raw_tracepoint/consume_skb")
15 int while_true(volatile struct pt_regs* ctx)
16 {
17         int i = 0;
18
19         while (true) {
20                 if (PT_REGS_RC(ctx) & 1)
21                         i += 3;
22                 else
23                         i += 7;
24                 if (i > 40)
25                         break;
26         }
27
28         return i;
29 }
This page took 0.032165 seconds and 4 git commands to generate.