mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-09 02:57:42 -04:00
Some of the bpf test progs still use linux/libc headers. Let's use vmlinux.h instead like the rest of test progs. This will also ease cross compiling. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20250821030254.398826-1-hengqi.chen@gmail.com
25 lines
395 B
C
25 lines
395 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) 2019 Facebook
|
|
#include "vmlinux.h"
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_tracing.h>
|
|
|
|
char _license[] SEC("license") = "GPL";
|
|
|
|
SEC("raw_tracepoint/consume_skb")
|
|
int while_true(volatile struct pt_regs* ctx)
|
|
{
|
|
int i = 0;
|
|
|
|
while (true) {
|
|
if (PT_REGS_RC(ctx) & 1)
|
|
i += 3;
|
|
else
|
|
i += 7;
|
|
if (i > 40)
|
|
break;
|
|
}
|
|
|
|
return i;
|
|
}
|