]>
iEval git - linux-seccomp.git/blob - libseccomp/tools/scmp_sys_resolver.c
4 * Copyright (c) 2012 Red Hat <pmoore@redhat.com>
5 * Author: Paul Moore <paul@paul-moore.com>
9 * This library is free software; you can redistribute it and/or modify it
10 * under the terms of version 2.1 of the GNU Lesser General Public License as
11 * published by the Free Software Foundation.
13 * This library is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, see <http://www.gnu.org/licenses>.
32 * Print the usage information to stderr and exit
33 * @param program the name of the current program being invoked
35 * Print the usage information and exit with EINVAL.
38 static void exit_usage(const char *program
)
41 "usage: %s [-h] [-a <arch>] [-t] <name>|<number>\n",
49 int main(int argc
, char *argv
[])
57 arch
= seccomp_arch_native();
59 /* parse the command line */
60 while ((opt
= getopt(argc
, argv
, "a:ht")) > 0) {
63 arch
= seccomp_arch_resolve_name(optarg
);
72 /* usage information */
81 /* perform the syscall lookup */
82 if (isdigit(argv
[optind
][0]) || argv
[optind
][0] == '-') {
83 sys_num
= atoi(argv
[optind
]);
84 sys_name
= seccomp_syscall_resolve_num_arch(arch
, sys_num
);
85 printf("%s\n", (sys_name
? sys_name
: "UNKNOWN"));
86 } else if (translate
) {
87 sys_num
= seccomp_syscall_resolve_name_rewrite(arch
,
89 printf("%d\n", sys_num
);
91 sys_num
= seccomp_syscall_resolve_name_arch(arch
, argv
[optind
]);
92 printf("%d\n", sys_num
);
This page took 0.045454 seconds and 4 git commands to generate.