diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-12-01 00:46:36 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-12-04 03:25:44 +0300 |
commit | 556bed5c6d4167f9ffb5c8648cdd3c8e39aefec7 (patch) | |
tree | 7d4f2c014cc0217a5d1318ac5f0eb9c3e1e525a1 /tools/perf/trace | |
parent | 072b6ad7cac6a868e56dec5f48a2e67d9ab8cb6e (diff) | |
download | linux-556bed5c6d4167f9ffb5c8648cdd3c8e39aefec7.tar.xz |
perf beauty: Don't use 'find ... -printf' as it isn't available in busybox
Namhyung reported:
I'm seeing a build error on my Alpine linux image which uses busybox +
musl libc:
In file included from trace/beauty/arch_errno_names.c:1,
from builtin-trace.c:899:
/build/trace/beauty/generated/arch_errno_name_array.c: In function 'arch_syscalls__strerrno':
/build/trace/beauty/generated/arch_errno_name_array.c:142:49: error: unused parameter 'arch' [-Werror=unused-parameter]
142 | const char *arch_syscalls__strerrno(const char *arch, int err)
It looks like busybox find command doesn't have -printf option
find: unrecognized: -printf
, Yesterday 9:16 PM
,
BusyBox v1.36.1 (2023-07-27 17:12:24 UTC) multi-call binary.
Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]
Search for files and perform actions on them.
First failed action stops processing of current file.
Defaults: PATH is current directory, action is '-print'
So just remove it and pipe find's entry to a basename loop to produce
the same result.
Then use an alternative loop that relies on the shell to avoid needless
forks and execs.
The discussion about it generated the impetus to stop doing strcmps to
find the right table at each errno to string translation but instead do
this just once and then use a function pointer to the right arch
specific table.
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Reported-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/trace')
-rwxr-xr-x | tools/perf/trace/beauty/arch_errno_names.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh index cc09dcaa891e..b6e0767b4b34 100755 --- a/tools/perf/trace/beauty/arch_errno_names.sh +++ b/tools/perf/trace/beauty/arch_errno_names.sh @@ -76,7 +76,9 @@ EoHEADER # Create list of architectures that have a specific errno.h. archlist="" -for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | sort -r); do +for f in $toolsdir/arch/*/include/uapi/asm/errno.h; do + d=${f%/include/uapi/asm/errno.h} + arch="${d##*/}" test -f $toolsdir/arch/$arch/include/uapi/asm/errno.h && archlist="$archlist $arch" done |