]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
libbpf: fix missing __WORDSIZE definition
authorAndrii Nakryiko <andriin@fb.com>
Thu, 18 Jul 2019 17:30:21 +0000 (10:30 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 29 Jul 2019 13:18:08 +0000 (10:18 -0300)
hashmap.h depends on __WORDSIZE being defined. It is defined by
glibc/musl in different headers. It's an explicit goal for musl to be
"non-detectable" at compilation time, so instead include glibc header if
glibc is explicitly detected and fall back to musl header otherwise.

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
Link: https://lkml.kernel.org/r/20190718173021.2418606-1-andriin@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/bpf/hashmap.h

index 03748a7421466c66ad9649561eda2cde29dc9f70..bae8879cdf58ae659ae8bfa71da0cf3f3877b294 100644 (file)
 
 #include <stdbool.h>
 #include <stddef.h>
+#ifdef __GLIBC__
+#include <bits/wordsize.h>
+#else
+#include <bits/reg.h>
+#endif
 #include "libbpf_internal.h"
 
 static inline size_t hash_bits(size_t h, int bits)