Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf env: Move arch errno function to only use in env

Move arch_syscalls__strerrno_function out of builtin-trace.c to env.c
so that there isn't a util to builtin function call. This allows the
python.c stub to be removed. Also, remove declaration/prototype from
env.h and make static to reduce scope. The include is moved inside
ifdefs to avoid, "defined but unused warnings".

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Veronika Molnarova <vmolnaro@redhat.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Link: https://lore.kernel.org/r/20241119011644.971342-15-irogers@google.com
perf: perf python: Correctly throw IndexError
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
16ecb431 254a867b

+6 -10
-1
tools/perf/builtin-trace.c
··· 1113 1113 .strtoul = STUL_STRARRAY_FLAGS, \ 1114 1114 .parm = &strarray__##array, } 1115 1115 1116 - #include "trace/beauty/arch_errno_names.c" 1117 1116 #include "trace/beauty/eventfd.c" 1118 1117 #include "trace/beauty/futex_op.c" 1119 1118 #include "trace/beauty/futex_val3.c"
+2 -1
tools/perf/trace/beauty/arch_errno_names.sh
··· 57 57 archlist="$1" 58 58 default="$2" 59 59 60 - printf 'arch_syscalls__strerrno_t *arch_syscalls__strerrno_function(const char *arch)\n' 60 + printf 'static arch_syscalls__strerrno_t *\n' 61 + printf 'arch_syscalls__strerrno_function(const char *arch)\n' 61 62 printf '{\n' 62 63 for arch in $archlist; do 63 64 arch_str=$(arch_string "$arch")
+4
tools/perf/util/env.c
··· 480 480 return normalize_arch(arch_name); 481 481 } 482 482 483 + #if defined(HAVE_SYSCALL_TABLE_SUPPORT) && defined(HAVE_LIBTRACEEVENT) 484 + #include "trace/beauty/arch_errno_names.c" 485 + #endif 486 + 483 487 const char *perf_env__arch_strerrno(struct perf_env *env __maybe_unused, int err __maybe_unused) 484 488 { 485 489 #if defined(HAVE_SYSCALL_TABLE_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
-2
tools/perf/util/env.h
··· 56 56 57 57 typedef const char *(arch_syscalls__strerrno_t)(int err); 58 58 59 - arch_syscalls__strerrno_t *arch_syscalls__strerrno_function(const char *arch); 60 - 61 59 struct perf_env { 62 60 char *hostname; 63 61 char *os_release;
-6
tools/perf/util/python.c
··· 16 16 #include "thread_map.h" 17 17 #include "trace-event.h" 18 18 #include "mmap.h" 19 - #include "util/env.h" 20 19 #include "util/kwork.h" 21 20 #include "util/sample.h" 22 21 #include "util/lock-contention.h" ··· 1303 1304 1304 1305 /* The following are stubs to avoid dragging in builtin-* objects. */ 1305 1306 /* TODO: move the code out of the builtin-* file into util. */ 1306 - 1307 - arch_syscalls__strerrno_t *arch_syscalls__strerrno_function(const char *arch __maybe_unused) 1308 - { 1309 - return NULL; 1310 - } 1311 1307 1312 1308 struct kwork_work *perf_kwork_add_work(struct perf_kwork *kwork __maybe_unused, 1313 1309 struct kwork_class *class __maybe_unused,