linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8
@ 2024-04-03 12:25 Yang Jihong
  2024-04-03 14:21 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Jihong @ 2024-04-03 12:25 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, kan.liang, james.clark,
	linux-perf-users, linux-kernel
  Cc: yangjihong

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@bytedance.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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8
  2024-04-03 12:25 [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8 Yang Jihong
@ 2024-04-03 14:21 ` Arnaldo Carvalho de Melo
  2024-04-03 15:05   ` Ian Rogers
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-04-03 14:21 UTC (permalink / raw)
  To: Yang Jihong
  Cc: peterz, mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, kan.liang, james.clark, linux-perf-users,
	linux-kernel

On Wed, Apr 03, 2024 at 08:25:58PM +0800, Yang Jihong wrote:
> 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.

Thanks, I test on it, but since I didn't found libtraceevent-devel
available there, then I have to build with NO_LIBTRACEEVENT=1 and thus
this doesn't get built :-\

Thanks, applying.

- Arnaldo
 
> Fixes: 8a1ad4413519 ("tools headers: Remove now unused copies of uapi/{fcntl,openat2}.h and asm/fcntl.h")
> Signed-off-by: Yang Jihong <yangjihong@bytedance.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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8
  2024-04-03 14:21 ` Arnaldo Carvalho de Melo
@ 2024-04-03 15:05   ` Ian Rogers
  2024-04-03 15:33     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2024-04-03 15:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Yang Jihong, peterz, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, kan.liang, james.clark,
	linux-perf-users, linux-kernel

On Wed, Apr 3, 2024 at 7:21 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> On Wed, Apr 03, 2024 at 08:25:58PM +0800, Yang Jihong wrote:
> > 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.
>
> Thanks, I test on it, but since I didn't found libtraceevent-devel
> available there, then I have to build with NO_LIBTRACEEVENT=1 and thus
> this doesn't get built :-\
>
> Thanks, applying.

Yang also wrote:
https://lore.kernel.org/lkml/20240314063000.2139877-1-yangjihong@bytedance.com/
that may have helped you with this.

Thanks,
Ian

> - Arnaldo
>
> > Fixes: 8a1ad4413519 ("tools headers: Remove now unused copies of uapi/{fcntl,openat2}.h and asm/fcntl.h")
> > Signed-off-by: Yang Jihong <yangjihong@bytedance.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
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8
  2024-04-03 15:05   ` Ian Rogers
@ 2024-04-03 15:33     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-04-03 15:33 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Yang Jihong, peterz, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, kan.liang, james.clark,
	linux-perf-users, linux-kernel

On Wed, Apr 03, 2024 at 08:05:32AM -0700, Ian Rogers wrote:
> On Wed, Apr 3, 2024 at 7:21 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >
> > On Wed, Apr 03, 2024 at 08:25:58PM +0800, Yang Jihong wrote:
> > > 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.
> >
> > Thanks, I test on it, but since I didn't found libtraceevent-devel
> > available there, then I have to build with NO_LIBTRACEEVENT=1 and thus
> > this doesn't get built :-\
> >
> > Thanks, applying.
> 
> Yang also wrote:
> https://lore.kernel.org/lkml/20240314063000.2139877-1-yangjihong@bytedance.com/
> that may have helped you with this.

Yeah, if I change my build container on distros that don't provide
libtraceevent-devel to build it from sources, and then point the perf
build to that directory, I'll try to do that.

And I just merged that patch, thanks for pointing it out.

- Arnaldo
 
> Thanks,
> Ian
> 
> > - Arnaldo
> >
> > > Fixes: 8a1ad4413519 ("tools headers: Remove now unused copies of uapi/{fcntl,openat2}.h and asm/fcntl.h")
> > > Signed-off-by: Yang Jihong <yangjihong@bytedance.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
> > >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-03 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 12:25 [PATCH] perf beauty: Fix AT_EACCESS undeclared build error for system with kernel versions lower than v5.8 Yang Jihong
2024-04-03 14:21 ` Arnaldo Carvalho de Melo
2024-04-03 15:05   ` Ian Rogers
2024-04-03 15:33     ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).