blob: c97e5560b926a6dab51c2429a4c261213b0f04d1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* See LICENSE file for copyright and license details. */
#include "../libsyscalls.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
enum libsyscalls_os os;
enum libsyscalls_arch arch;
const struct libsyscalls_named_number *errors;
size_t i, nerrors;
enum libsyscalls_error err;
(void) argc;
os = (enum libsyscalls_os)atoi(argv[1]);
arch = (enum libsyscalls_arch)atoi(argv[2]);
libsyscalls_get_syscall_errors(os, 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;
}
|