0001
0002 #include <asm/unistd.h>
0003 #include <linux/bpf.h>
0004 #include <unistd.h>
0005
0006 #ifndef __NR_bpf
0007 # if defined(__i386__)
0008 # define __NR_bpf 357
0009 # elif defined(__x86_64__)
0010 # define __NR_bpf 321
0011 # elif defined(__aarch64__)
0012 # define __NR_bpf 280
0013 # elif defined(__sparc__)
0014 # define __NR_bpf 349
0015 # elif defined(__s390__)
0016 # define __NR_bpf 351
0017 # elif defined(__mips__) && defined(_ABIO32)
0018 # define __NR_bpf 4355
0019 # elif defined(__mips__) && defined(_ABIN32)
0020 # define __NR_bpf 6319
0021 # elif defined(__mips__) && defined(_ABI64)
0022 # define __NR_bpf 5315
0023 # else
0024 # error __NR_bpf not defined. libbpf does not support your arch.
0025 # endif
0026 #endif
0027
0028 int main(void)
0029 {
0030 union bpf_attr attr;
0031
0032
0033 attr.prog_type = BPF_PROG_TYPE_KPROBE;
0034 attr.insn_cnt = 0;
0035 attr.insns = 0;
0036 attr.license = 0;
0037 attr.log_buf = 0;
0038 attr.log_size = 0;
0039 attr.log_level = 0;
0040 attr.kern_version = 0;
0041 attr.prog_flags = 0;
0042
0043
0044
0045
0046
0047 return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
0048 }