Skip to content

Commit 7de969a

Browse files
authored
libbpf-tools: syscall_helpers.c: support loongarch64 and add more generic syscall (#5263)
Display syscall name on loongarch64, instead of fallback to '[unknown: %u]'. Signed-off-by: Rong Tao <[email protected]>
1 parent 24a1033 commit 7de969a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

libbpf-tools/syscall_helpers.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ void init_syscall_names(void)
104104
err = pclose(f);
105105
if (err < 0)
106106
warn("pclose: %s\n", strerror(errno));
107-
#if !defined(__x86_64__) && !defined(__aarch64__) && !defined(__riscv)
108-
/* Ignore the error for x86_64/arm64/riscv where we have a table compiled in */
107+
#if !defined(__x86_64__) && !defined(__aarch64__) && !defined(__riscv) && !defined(__loongarch64)
108+
/* Ignore the error for x86_64/arm64/riscv/loongarch64 where we have a table compiled in */
109109
else if (err && WEXITSTATUS(err) == 127) {
110110
warn("ausyscall required for syscalls number/name mapping\n");
111111
} else if (err) {
@@ -487,7 +487,7 @@ static const char *syscall_names_x86_64[] = {
487487
[438] = "pidfd_getfd",
488488
};
489489
size_t syscall_names_x86_64_size = sizeof(syscall_names_x86_64)/sizeof(char*);
490-
#elif defined(__aarch64__) || defined(__riscv)
490+
#elif defined(__aarch64__) || defined(__riscv) || defined(__loongarch64)
491491
static const char *syscall_names_generic[] = {
492492
[0] = "io_setup",
493493
[1] = "io_destroy",
@@ -800,6 +800,12 @@ static const char *syscall_names_generic[] = {
800800
[448] = "process_mrelease",
801801
[449] = "futex_waitv",
802802
[450] = "set_mempolicy_home_node",
803+
[451] = "cachestat",
804+
[452] = "fchmodat2",
805+
[453] = "map_shadow_stack",
806+
[454] = "futex_wake",
807+
[455] = "futex_wait",
808+
[456] = "futex_requeue",
803809
};
804810
size_t syscall_names_generic_size = sizeof(syscall_names_generic)/sizeof(char*);
805811
#endif
@@ -813,7 +819,7 @@ void syscall_name(unsigned n, char *buf, size_t size)
813819
#ifdef __x86_64__
814820
else if (n < syscall_names_x86_64_size)
815821
name = syscall_names_x86_64[n];
816-
#elif defined(__aarch64__) || defined(__riscv)
822+
#elif defined(__aarch64__) || defined(__riscv) || defined(__loongarch64)
817823
else if (n < syscall_names_generic_size)
818824
name = syscall_names_generic[n];
819825
#endif
@@ -834,7 +840,7 @@ int list_syscalls(void)
834840
size = syscall_names_x86_64_size;
835841
list = syscall_names_x86_64;
836842
}
837-
#elif defined(__aarch64__) || defined(__riscv)
843+
#elif defined(__aarch64__) || defined(__riscv) || defined(__loongarch64)
838844
if (!size) {
839845
size = syscall_names_generic_size;
840846
list = syscall_names_generic;

0 commit comments

Comments
 (0)