diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-16 13:47:10 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-16 13:47:10 +0100 |
commit | 522948817bebc886ad236450745466975633e977 (patch) | |
tree | f53fc385c29be9b08d9c8f9c88a00ce9d1543de4 /testutil | |
parent | All kinds of stuff (diff) | |
download | libsyscalls-522948817bebc886ad236450745466975633e977.tar.gz libsyscalls-522948817bebc886ad236450745466975633e977.tar.bz2 libsyscalls-522948817bebc886ad236450745466975633e977.tar.xz |
Tell the user whether signals and errors are signed or unsigned
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | testutil/get-signals.c | 14 | ||||
-rw-r--r-- | testutil/get-syscall-errors.c | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/testutil/get-signals.c b/testutil/get-signals.c index f97484f..54fcac4 100644 --- a/testutil/get-signals.c +++ b/testutil/get-signals.c @@ -13,7 +13,7 @@ int main(int argc, char **argv) { - int os, arch; + int os, arch, are_signed; const struct libsyscalls_named_number *signals; size_t i, nsignals; enum libsyscalls_error err; @@ -26,7 +26,8 @@ main(int argc, char **argv) os = atoi(argv[1]); arch = atoi(argv[2]); - err = libsyscalls_get_signals((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, &signals, &nsignals); + err = libsyscalls_get_signals((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, + &signals, &nsignals, &are_signed); if (err == LIBSYSCALLS_E_OSNOSUP || err == LIBSYSCALLS_E_ARCHNOSUP) { printf("x\n"); return 0; @@ -38,8 +39,13 @@ main(int argc, char **argv) return 1; } - for (i = 0; i < nsignals; i++) - printf("%lli %llu %s\n", signals[i].number.s, signals[i].number.u, signals[i].name); + if (are_signed) { + for (i = 0; i < nsignals; i++) + printf("%+lli %s\n", signals[i].number.s, signals[i].name); + } else { + for (i = 0; i < nsignals; i++) + printf("%llu %s\n", signals[i].number.u, signals[i].name); + } if (fflush(stdout) || fclose(stdout)) { perror(NULL); diff --git a/testutil/get-syscall-errors.c b/testutil/get-syscall-errors.c index d1ddfd7..a5923f4 100644 --- a/testutil/get-syscall-errors.c +++ b/testutil/get-syscall-errors.c @@ -13,7 +13,7 @@ int main(int argc, char **argv) { - int os, arch; + int os, arch, are_signed; const struct libsyscalls_named_number *errors; size_t i, nerrors; enum libsyscalls_error err; @@ -26,7 +26,8 @@ main(int argc, char **argv) os = atoi(argv[1]); arch = atoi(argv[2]); - err = libsyscalls_get_syscall_errors((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, &errors, &nerrors); + err = libsyscalls_get_syscall_errors((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, + &errors, &nerrors, &are_signed); if (err == LIBSYSCALLS_E_OSNOSUP || err == LIBSYSCALLS_E_ARCHNOSUP) { printf("x\n"); return 0; @@ -38,8 +39,13 @@ main(int argc, char **argv) return 1; } - for (i = 0; i < nerrors; i++) - printf("%lli %llu %s\n", errors[i].number.s, errors[i].number.u, errors[i].name); + if (are_signed) { + for (i = 0; i < nerrors; i++) + printf("%+lli %s\n", errors[i].number.s, errors[i].name); + } else { + for (i = 0; i < nerrors; i++) + printf("%llu %s\n", errors[i].number.u, errors[i].name); + } if (fflush(stdout) || fclose(stdout)) { perror(NULL); |