mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00: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 <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
19 lines
377 B
C
19 lines
377 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(struct pt_regs *ctx)
|
|
{
|
|
volatile __u64 i = 0, sum = 0;
|
|
do {
|
|
i++;
|
|
sum += PT_REGS_RC(ctx);
|
|
} while (i < 0x100000000ULL);
|
|
return sum;
|
|
}
|