]>
iEval git - linux-seccomp.git/blob - libseccomp/src/arch-syscall-dump.c
2 * Enhanced Seccomp Architecture Sycall Checker
4 * Copyright (c) 2014 Red Hat <pmoore@redhat.com>
5 * Author: Paul Moore <paul@paul-moore.com>
10 * This library is free software; you can redistribute it and/or modify it
11 * under the terms of version 2.1 of the GNU Lesser General Public License as
12 * published by the Free Software Foundation.
14 * This library is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, see <http://www.gnu.org/licenses>.
34 #include "arch-x86_64.h"
37 #include "arch-mips.h"
38 #include "arch-mips64.h"
39 #include "arch-mips64n32.h"
40 #include "arch-aarch64.h"
42 #include "arch-ppc64.h"
43 #include "arch-s390.h"
44 #include "arch-s390x.h"
47 * Print the usage information to stderr and exit
48 * @param program the name of the current program being invoked
50 * Print the usage information and exit with EINVAL.
53 static void exit_usage(const char *program
)
55 fprintf(stderr
, "usage: %s [-h] [-a <arch>] [-o <offset>]\n", program
);
62 int main(int argc
, char *argv
[])
65 const struct arch_def
*arch
= arch_def_native
;
71 /* parse the command line */
72 while ((opt
= getopt(argc
, argv
, "a:o:h")) > 0) {
75 arch
= arch_def_lookup_name(optarg
);
80 offset
= atoi(optarg
);
84 /* usage information */
91 switch (arch
->token
) {
93 sys_name
= x86_syscall_iterate_name(iter
);
95 case SCMP_ARCH_X86_64
:
96 sys_name
= x86_64_syscall_iterate_name(iter
);
99 sys_name
= x32_syscall_iterate_name(iter
);
102 sys_name
= arm_syscall_iterate_name(iter
);
104 case SCMP_ARCH_AARCH64
:
105 sys_name
= aarch64_syscall_iterate_name(iter
);
108 case SCMP_ARCH_MIPSEL
:
109 sys_name
= mips_syscall_iterate_name(iter
);
111 case SCMP_ARCH_MIPS64
:
112 case SCMP_ARCH_MIPSEL64
:
113 sys_name
= mips64_syscall_iterate_name(iter
);
115 case SCMP_ARCH_MIPS64N32
:
116 case SCMP_ARCH_MIPSEL64N32
:
117 sys_name
= mips64n32_syscall_iterate_name(iter
);
120 sys_name
= ppc_syscall_iterate_name(iter
);
122 case SCMP_ARCH_PPC64
:
123 case SCMP_ARCH_PPC64LE
:
124 sys_name
= ppc64_syscall_iterate_name(iter
);
127 sys_name
= s390_syscall_iterate_name(iter
);
129 case SCMP_ARCH_S390X
:
130 sys_name
= s390x_syscall_iterate_name(iter
);
136 if (sys_name
!= NULL
) {
137 sys_num
= arch_syscall_resolve_name(arch
, sys_name
);
138 if (offset
> 0 && sys_num
> 0)
141 /* output the results */
142 printf("%s\t%d\n", sys_name
, sys_num
);
147 } while (sys_name
!= NULL
);
This page took 0.053922 seconds and 5 git commands to generate.