summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-07-18 13:30:21 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-07-29 09:18:08 -0400
commit8aa259b10a6a759c50137bbbf225df0c17ca5d27 (patch)
treef51cf6680b72bfc55b91126ea05639aa854caad3
parent2e9a06dda10aea81a17c623f08534dac6735434a (diff)
libbpf: fix missing __WORDSIZE definition
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>
-rw-r--r--tools/lib/bpf/hashmap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
index 03748a742146..bae8879cdf58 100644
--- a/tools/lib/bpf/hashmap.h
+++ b/tools/lib/bpf/hashmap.h
@@ -10,6 +10,11 @@
10 10
11#include <stdbool.h> 11#include <stdbool.h>
12#include <stddef.h> 12#include <stddef.h>
13#ifdef __GLIBC__
14#include <bits/wordsize.h>
15#else
16#include <bits/reg.h>
17#endif
13#include "libbpf_internal.h" 18#include "libbpf_internal.h"
14 19
15static inline size_t hash_bits(size_t h, int bits) 20static inline size_t hash_bits(size_t h, int bits)