Re: [PATCH] perf trace beauty fcntl: Fix build with older kernel headers

From: Namhyung Kim

Date: Thu May 14 2026 - 11:57:02 EST


Hello,

On Wed, May 13, 2026 at 12:23:46PM -0700, Florian Fainelli wrote:
> Toolchains with older kernel headers that do not include upstream commit
> c75b1d9421f80f4143e389d2d50ddfc8a28c8c35 ("fs: add fcntl() interface for
> setting/getting write life time hints") will now fail to build perf due
> to missing definitions for
> F_GET_RW_HINT/F_SET_RW_HINT/F_GET_FILE_RW_HINT/F_SET_FILE_RW_HINT.

Can you share the error messages?

I think this code should use a copy of the header in
trace/beauty/include/uapi/linux/fcntl.h which has the definitions.

Thanks,
Namhyung

>
> Provide a fallback definition for these when they are not already
> defined.
>
> Fixes: 9c47f6674838 ("perf trace beauty fcntl: Basic 'arg' beautifier")
> Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
> ---
> tools/perf/trace/beauty/fcntl.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/tools/perf/trace/beauty/fcntl.c b/tools/perf/trace/beauty/fcntl.c
> index d075904dccce..e1b99b8f55eb 100644
> --- a/tools/perf/trace/beauty/fcntl.c
> +++ b/tools/perf/trace/beauty/fcntl.c
> @@ -9,6 +9,22 @@
> #include <linux/kernel.h>
> #include <linux/fcntl.h>
>
> +#ifndef F_GET_RW_HINT
> +#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11)
> +#endif
> +
> +#ifndef F_SET_RW_HINT
> +#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
> +#endif
> +
> +#ifndef F_GET_FILE_RW_HINT
> +#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
> +#endif
> +
> +#ifndef F_SET_FILE_RW_HINT
> +#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
> +#endif
> +
> static size_t fcntl__scnprintf_getfd(unsigned long val, char *bf, size_t size, bool show_prefix)
> {
> return val ? scnprintf(bf, size, "%s", "0") :
> --
> 2.34.1
>