X-Git-Url: http://git.ieval.ro/?p=linux-seccomp.git;a=blobdiff_plain;f=libseccomp%2Ftools%2Fscmp_sys_resolver.c;fp=libseccomp%2Ftools%2Fscmp_sys_resolver.c;h=0000000000000000000000000000000000000000;hp=9be2c24cce660bdd45c36a1f044e907dc2c943d0;hb=a7f80a138de41255578bc28d034438a295ecbb2e;hpb=a8d04cb21e9ce2cfa37d893162df3e4943d9e480 diff --git a/libseccomp/tools/scmp_sys_resolver.c b/libseccomp/tools/scmp_sys_resolver.c deleted file mode 100644 index 9be2c24..0000000 --- a/libseccomp/tools/scmp_sys_resolver.c +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Syscall resolver - * - * Copyright (c) 2012 Red Hat - * Author: Paul Moore - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include -#include -#include -#include -#include -#include - -#include - -/** - * Print the usage information to stderr and exit - * @param program the name of the current program being invoked - * - * Print the usage information and exit with EINVAL. - * - */ -static void exit_usage(const char *program) -{ - fprintf(stderr, - "usage: %s [-h] [-a ] [-t] |\n", - program); - exit(EINVAL); -} - -/** - * main - */ -int main(int argc, char *argv[]) -{ - int opt; - int translate = 0; - uint32_t arch; - int sys_num; - const char *sys_name; - - arch = seccomp_arch_native(); - - /* parse the command line */ - while ((opt = getopt(argc, argv, "a:ht")) > 0) { - switch (opt) { - case 'a': - arch = seccomp_arch_resolve_name(optarg); - if (arch == 0) - exit_usage(argv[0]); - break; - case 't': - translate = 1; - break; - case 'h': - default: - /* usage information */ - exit_usage(argv[0]); - } - } - - /* sanity checks */ - if (optind >= argc) - exit_usage(argv[0]); - - /* perform the syscall lookup */ - if (isdigit(argv[optind][0]) || argv[optind][0] == '-') { - sys_num = atoi(argv[optind]); - sys_name = seccomp_syscall_resolve_num_arch(arch, sys_num); - printf("%s\n", (sys_name ? sys_name : "UNKNOWN")); - } else if (translate) { - sys_num = seccomp_syscall_resolve_name_rewrite(arch, - argv[optind]); - printf("%d\n", sys_num); - } else { - sys_num = seccomp_syscall_resolve_name_arch(arch, argv[optind]); - printf("%d\n", sys_num); - } - - return 0; -}