linux/tools/testing/selftests/bpf/progs/test_global_func14.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-only
   2#include <stddef.h>
   3#include <linux/bpf.h>
   4#include <bpf/bpf_helpers.h>
   5
   6struct S;
   7
   8__noinline int foo(const struct S *s)
   9{
  10        if (s)
  11                return bpf_get_prandom_u32() < *(const int *) s;
  12
  13        return 0;
  14}
  15
  16SEC("cgroup_skb/ingress")
  17int test_cls(struct __sk_buff *skb)
  18{
  19
  20        return foo(NULL);
  21}
  22