/* See LICENSE file for copyright and license details. */ #include "../libsyscalls.h" #include #include #include #if defined(__clang__) # pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* clang is just being silly */ #endif int main(int argc, char **argv) { int os, arch; const struct libsyscalls_named_number *errors; size_t i, nerrors; enum libsyscalls_error err; if (argc != 5) { fprintf(stderr, "usage error\n"); return 3; } os = atoi(argv[1]); arch = atoi(argv[2]); err = libsyscalls_get_syscall_errors((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, &errors, &nerrors); if (err == LIBSYSCALLS_E_OSNOSUP || err == LIBSYSCALLS_E_ARCHNOSUP) { printf("x\n"); return 0; } else if (err == LIBSYSCALLS_E_NOERRORS) { return 0; } else if (err) { fprintf(stderr, "test-get-syscall-errors %s %s: ", argv[3], argv[4]); libsyscalls_perror(NULL, err); 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 (fflush(stdout) || fclose(stdout)) { perror(NULL); return 1; } return 0; }