tools/bpf: add missing strings.h include
Subsystems (4)
PATCH v2 1/1 tools/bpf: add missing strings.h include
Few files in libbpf are using bzero() function (defined in strings.h header), but don't include corresponding header. When libbpf is added as a dependency to pahole, this undeterministically causes warnings on some machines:
bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
bzero(&attr, sizeof(attr));
^~~~~Signed-off-by Andrii Nakryiko <[email protected]>
Reported-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/lib/bpf/bpf.c | 1 + tools/lib/bpf/btf.c | 1 + tools/lib/bpf/libbpf.c | 1 + 3 files changed, 3 insertions(+)
tools/lib/bpf/bpf.c +1 -0
@@ -22,6 +22,7 @@*/ #include <stdlib.h> +#include <strings.h> #include <memory.h> #include <unistd.h> #include <asm/unistd.h>
tools/lib/bpf/btf.c +1 -0
@@ -4,6 +4,7 @@#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <unistd.h> #include <errno.h> #include <linux/err.h>
tools/lib/bpf/libbpf.c +1 -0
@@ -18,6 +18,7 @@#include <libgen.h> #include <inttypes.h> #include <string.h> +#include <strings.h> #include <unistd.h> #include <fcntl.h> #include <errno.h>
Signature · 1 line
2.17.1
Alexei Starovoitov
AppliedQuoted 10 lines · Andrii Nakryiko
Few files in libbpf are using
bzero()function (defined instrings.hheader), but don't include corresponding header. When libbpf is added as a dependency to pahole, this undeterministically causes warnings on some machines:bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration]
bzero(&attr, sizeof(attr)); ^~~~~Signed-off-by Andrii Nakryiko <[email protected]>Reported-by Arnaldo Carvalho de Melo <[email protected]>
Applied, Thanks