brintos

brintos / linux-shallow public Read only

0
0
Text · 498 B · e5fff7f Raw
25 lines · c
1// SPDX-License-Identifier: GPL-2.02#include <linux/bpf.h>3#include <bpf/bpf_helpers.h>4#include <bpf/bpf_tracing.h>5#include <stdbool.h>6 7#ifdef ENABLE_ATOMICS_TESTS8bool skip_tests __attribute((__section__(".data"))) = false;9#else10bool skip_tests = true;11#endif12 13SEC("fentry/bpf_fentry_test1")14int BPF_PROG(sub, int x)15{16#ifdef ENABLE_ATOMICS_TESTS17	int a = 0;18	int b = __sync_fetch_and_add(&a, 1);19	/* b is certainly 0 here. Can the verifier tell? */20	while (b)21		continue;22#endif23	return 0;24}25