Re: [PATCH v5 03/23] perf trace: Include the headers declaring pid_t, strcmp and assert

From: Namhyung Kim

Date: Thu Sep 24 2026 - 01:45:17 EST


On Wed, Sep 23, 2026 at 12:13:43AM -0700, Ian Rogers wrote:
> trace_augment.h uses pid_t in the augmented_syscalls__set_filter_pids()
> prototype and in the !HAVE_BPF_SKEL stub. bpf_trace_augment.c calls
> strcmp() in augmented_syscalls__find_by_title() and assert() in
> augmented_syscalls__create_bpf_output(), but neither pulls in the header
> that declares what it uses. Both happen to build today only because
> something else in the include chain drags <sys/types.h>, <string.h> and
> <assert.h> in first, which is not guaranteed and does not hold on libcs
> such as musl that keep the POSIX namespaces strictly separated.
>
> Include <sys/types.h>, <string.h> and <assert.h> explicitly.
>
> Assisted-by: Antigravity:gemini-3.1-pro
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

I'm not sure why it has Arnaldo's Sign-off..

Thanks,
Namhyung

> ---
> tools/perf/util/bpf_trace_augment.c | 2 ++
> tools/perf/util/trace_augment.h | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/tools/perf/util/bpf_trace_augment.c b/tools/perf/util/bpf_trace_augment.c
> index a9cf2a77ded1..ebb26225fb04 100644
> --- a/tools/perf/util/bpf_trace_augment.c
> +++ b/tools/perf/util/bpf_trace_augment.c
> @@ -1,5 +1,7 @@
> +#include <assert.h>
> #include <bpf/libbpf.h>
> #include <internal/xyarray.h>
> +#include <string.h>
>
> #include "bpf_skel/augmented_raw_syscalls.skel.h"
> #include "debug.h"
> diff --git a/tools/perf/util/trace_augment.h b/tools/perf/util/trace_augment.h
> index 4f729bc67753..a1cd9a5e0213 100644
> --- a/tools/perf/util/trace_augment.h
> +++ b/tools/perf/util/trace_augment.h
> @@ -2,6 +2,7 @@
> #define TRACE_AUGMENT_H
>
> #include <linux/compiler.h>
> +#include <sys/types.h>
>
> struct bpf_program;
> struct evlist;
> --
> 2.56.0.rc1.315.gc6ed9934b7-goog
>