Hi Will,
Looks like other files just include this unconditionally, but have a comment explaining why. See util/branch.h and util/event.h. Maybe we should do the same for util/pmu.h, which is already included here?
I found below files which perf includes <linux/perf_event.h>. Instead of doing same for all, we'd better put this only for tools/include/uapi/linux/perf_event.h.
--- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h @@ -17,6 +17,9 @@
#include <linux/types.h> #include <linux/ioctl.h> +#if !defined(__GLIBC__) +#include <linux/stddef.h> +#endif #include <asm/byteorder.h>
/*
tools/perf/arch/arm/util/pmu.c:#include <linux/perf_event.h> tools/perf/arch/x86/util/pmu.c:#include <linux/perf_event.h> tools/perf/arch/x86/util/tsc.c:#include <linux/perf_event.h> tools/perf/lib/include/internal/evsel.h:#include <linux/perf_event.h> tools/perf/lib/include/perf/event.h:#include <linux/perf_event.h> tools/perf/lib/tests/test-evlist.c:#include <linux/perf_event.h> tools/perf/lib/tests/test-evsel.c:#include <linux/perf_event.h> tools/perf/tests/hists_common.c:#include <linux/perf_event.h> tools/perf/util/auxtrace.c:#include <linux/perf_event.h> tools/perf/util/auxtrace.h:#include <linux/perf_event.h> tools/perf/util/branch.h:#include <linux/perf_event.h> tools/perf/util/event.c:#include <linux/perf_event.h> tools/perf/util/evsel.c:#include <linux/perf_event.h> tools/perf/util/evsel.h:#include <linux/perf_event.h> tools/perf/util/header.h:#include <linux/perf_event.h> tools/perf/util/mem-events.h:#include <linux/perf_event.h> tools/perf/util/namespaces.h:#include <linux/perf_event.h> tools/perf/util/record.h:#include <linux/perf_event.h> tools/perf/util/session.h:#include <linux/perf_event.h> tools/perf/util/pmu.h:#include <linux/perf_event.h> tools/perf/util/synthetic-events.c:#include <linux/perf_event.h> tools/perf/util/parse-events.h:#include <linux/perf_event.h> tools/perf/util/perf_event_attr_fprintf.c:#include <linux/perf_event.h>
Best Regards, Chanho Park