[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240403122558.1438841-1-yangjihong@bytedance.com>
Date: Wed, 3 Apr 2024 20:25:58 +0800
From: Yang Jihong <yangjihong@...edance.com>
To: peterz@...radead.org,
mingo@...hat.com,
acme@...nel.org,
namhyung@...nel.org,
mark.rutland@....com,
alexander.shishkin@...ux.intel.com,
jolsa@...nel.org,
irogers@...gle.com,
adrian.hunter@...el.com,
kan.liang@...ux.intel.com,
james.clark@....com,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: yangjihong@...edance.com
Subject: [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8
In the environment of ubuntu20.04 (the version of kernel headers is 5.4),
there is an error in building perf:
CC trace/beauty/fs_at_flags.o
trace/beauty/fs_at_flags.c: In function ‘faccessat2__scnprintf_flags’:
trace/beauty/fs_at_flags.c:35:14: error: ‘AT_EACCESS’ undeclared (first use in this function); did you mean ‘DN_ACCESS’?
35 | if (flags & AT_EACCESS) {
| ^~~~~~~~~~
| DN_ACCESS
trace/beauty/fs_at_flags.c:35:14: note: each undeclared identifier is reported only once for each function it appears in
commit 8a1ad4413519 ("tools headers: Remove now unused copies of
uapi/{fcntl,openat2}.h and asm/fcntl.h") removes fcntl.h from tools
headers directory, and fs_at_flags.c uses the 'AT_EACCESS' macro.
This macro was introduced in the kernel version v5.8.
For system with a kernel version older than this version,
it will cause compilation to fail.
Fixes: 8a1ad4413519 ("tools headers: Remove now unused copies of uapi/{fcntl,openat2}.h and asm/fcntl.h")
Signed-off-by: Yang Jihong <yangjihong@...edance.com>
---
tools/perf/trace/beauty/fs_at_flags.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/trace/beauty/fs_at_flags.c b/tools/perf/trace/beauty/fs_at_flags.c
index c1365e8f0b96..c200669cb944 100644
--- a/tools/perf/trace/beauty/fs_at_flags.c
+++ b/tools/perf/trace/beauty/fs_at_flags.c
@@ -10,6 +10,14 @@
#include <linux/fcntl.h>
#include <linux/log2.h>
+/*
+ * uapi/linux/fcntl.h does not keep a copy in tools headers directory,
+ * for system with kernel versions before v5.8, need to sync AT_EACCESS macro.
+ */
+#ifndef AT_EACCESS
+#define AT_EACCESS 0x200
+#endif
+
#include "trace/beauty/generated/fs_at_flags_array.c"
static DEFINE_STRARRAY(fs_at_flags, "AT_");
--
2.25.1
Powered by blists - more mailing lists