summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorMickaël Salaün <mic@digikod.net>2017-02-10 00:21:44 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-10 21:56:08 +0100
commit702498a1426bc95b6f49f9c5fba616110cbd3947 (patch)
treefbe8a2496ebf88342e7e79030a33f0a865de7689 /tools/lib
parentbpf: Use bpf_create_map() from the library (diff)
downloadlinux-702498a1426bc95b6f49f9c5fba616110cbd3947.tar.xz
linux-702498a1426bc95b6f49f9c5fba616110cbd3947.zip
bpf: Remove bpf_sys.h from selftests
Add require dependency headers. Signed-off-by: Mickaël Salaün <mic@digikod.net> Cc: Alexei Starovoitov <ast@fb.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/bpf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index f8a2b7fa7741..50e04cc5dddd 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -50,7 +50,13 @@ static __u64 ptr_to_u64(const void *ptr)
static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
unsigned int size)
{
+#ifdef __NR_bpf
return syscall(__NR_bpf, cmd, attr, size);
+#else
+ fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
+ errno = ENOSYS;
+ return -1;
+#endif
}
int bpf_create_map(enum bpf_map_type map_type, int key_size,