Re: [PATCH] perf trace beauty fcntl: Fix build with older kernel headers
From: Ian Rogers
Date: Wed May 13 2026 - 16:59:19 EST
On Wed, May 13, 2026 at 12:23 PM Florian Fainelli
<florian.fainelli@xxxxxxxxxxxx> 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.
>
> Provide a fallback definition for these when they are not already
> defined.
This seems fine but the commit you mention was added to Linux 4.13. Is
there a reason you've run into this problem? The oldest active LTS
kernel is 4.19.
Thanks,
Ian
> 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
>