diff options
author | Paul Moore <pmoore@redhat.com> | 2013-01-30 10:38:59 -0500 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2013-03-26 18:15:10 -0400 |
commit | ab8d762e398577a65fb588c6fcf8d43c85bf23dc (patch) | |
tree | 329e85053c99bff908bcef0b46da8c3c31a30f3e | |
parent | 161f00d9ec6beb35b9517de3aff000208fe002c4 (diff) | |
download | libseccomp-ab8d762e398577a65fb588c6fcf8d43c85bf23dc.tar.gz |
arch: rename arch-i386* to arch-x86*
No code chanages here, just an effort to improve naming consistency
a bit.
Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/arch-x86-syscalls.c (renamed from src/arch-i386-syscalls.c) | 6 | ||||
-rw-r--r-- | src/arch-x86.c (renamed from src/arch-i386.c) | 33 | ||||
-rw-r--r-- | src/arch-x86.h (renamed from src/arch-i386.h) | 21 | ||||
-rw-r--r-- | src/arch.c | 15 | ||||
-rw-r--r-- | tools/sys_resolver.c | 4 |
6 files changed, 39 insertions, 42 deletions
diff --git a/src/Makefile b/src/Makefile index e7c2304..ae50f86 100644 --- a/src/Makefile +++ b/src/Makefile @@ -38,7 +38,7 @@ LIB_SHARED = libseccomp.so.$(VERSION_RELEASE) OBJS = \ api.o db.o arch.o \ - arch-i386.o arch-i386-syscalls.o \ + arch-x86.o arch-x86-syscalls.o \ arch-x86_64.o arch-x86_64-syscalls.o \ arch-x32.o arch-x32-syscalls.o \ arch-arm.o arch-arm-syscalls.o \ diff --git a/src/arch-i386-syscalls.c b/src/arch-x86-syscalls.c index 803b0e7..b44f2a2 100644 --- a/src/arch-i386-syscalls.c +++ b/src/arch-x86-syscalls.c @@ -1,5 +1,5 @@ /** - * Enhanced Seccomp i386 Syscall Table + * Enhanced Seccomp x86 Syscall Table * * Copyright (c) 2012 Red Hat <pmoore@redhat.com> * Author: Paul Moore <pmoore@redhat.com> @@ -22,10 +22,10 @@ #include <seccomp.h> #include "arch.h" -#include "arch-i386.h" +#include "arch-x86.h" /* NOTE: based on Linux 3.4.7 */ -const struct arch_syscall_def i386_syscall_table[] = \ +const struct arch_syscall_def x86_syscall_table[] = \ { { "accept", __PNR_accept }, { "accept4", __PNR_accept4 }, diff --git a/src/arch-i386.c b/src/arch-x86.c index 3738da7..42c0bb1 100644 --- a/src/arch-i386.c +++ b/src/arch-x86.c @@ -1,5 +1,5 @@ /** - * Enhanced Seccomp i386 Specific Code + * Enhanced Seccomp x86 Specific Code * * Copyright (c) 2012 Red Hat <pmoore@redhat.com> * Author: Paul Moore <pmoore@redhat.com> @@ -24,13 +24,13 @@ #include <linux/audit.h> #include "arch.h" -#include "arch-i386.h" +#include "arch-x86.h" -/* i386 syscall numbers */ -#define __i386_NR_socketcall 102 -#define __i386_NR_ipc 117 +/* x86 syscall numbers */ +#define __x86_NR_socketcall 102 +#define __x86_NR_ipc 117 -const struct arch_def arch_def_i386 = { +const struct arch_def arch_def_x86 = { .token = SCMP_ARCH_X86, .token_bpf = AUDIT_ARCH_I386, .size = ARCH_SIZE_32, @@ -51,13 +51,13 @@ const struct arch_def arch_def_i386 = { * failure. * */ -int i386_syscall_rewrite(const struct arch_def *arch, unsigned int strict, - int *syscall) +int x86_syscall_rewrite(const struct arch_def *arch, unsigned int strict, + int *syscall) { if ((*syscall) <= -100 && (*syscall) >= -117) - *syscall = __i386_NR_socketcall; + *syscall = __x86_NR_socketcall; else if ((*syscall) <= -200 && (*syscall) >= -211) - *syscall = __i386_NR_ipc; + *syscall = __x86_NR_ipc; else if (((*syscall) < 0) && (strict)) return -EDOM; @@ -79,14 +79,13 @@ int i386_syscall_rewrite(const struct arch_def *arch, unsigned int strict, * fail. Returns zero on success, negative values on failure. * */ -int i386_filter_rewrite(const struct arch_def *arch, - unsigned int strict, - int *syscall, struct db_api_arg *chain) +int x86_filter_rewrite(const struct arch_def *arch, unsigned int strict, + int *syscall, struct db_api_arg *chain) { unsigned int iter; if ((*syscall) <= -100 && (*syscall) >= -117) { - for (iter = 0; iter < i386_arg_count_max; iter++) { + for (iter = 0; iter < x86_arg_count_max; iter++) { if ((chain[iter].valid != 0) && (strict)) return -EINVAL; } @@ -95,9 +94,9 @@ int i386_filter_rewrite(const struct arch_def *arch, chain[0].mask = DATUM_MAX; chain[0].datum = abs(*syscall) % 100; chain[0].valid = 1; - *syscall = __i386_NR_socketcall; + *syscall = __x86_NR_socketcall; } else if ((*syscall) <= -200 && (*syscall) >= -211) { - for (iter = 0; iter < i386_arg_count_max; iter++) { + for (iter = 0; iter < x86_arg_count_max; iter++) { if ((chain[iter].valid != 0) && (strict)) return -EINVAL; } @@ -106,7 +105,7 @@ int i386_filter_rewrite(const struct arch_def *arch, chain[0].mask = DATUM_MAX; chain[0].datum = abs(*syscall) % 200; chain[0].valid = 1; - *syscall = __i386_NR_ipc; + *syscall = __x86_NR_ipc; } else if (((*syscall) < 0) && (strict)) return -EDOM; diff --git a/src/arch-i386.h b/src/arch-x86.h index 809b769..924a82f 100644 --- a/src/arch-i386.h +++ b/src/arch-x86.h @@ -1,5 +1,5 @@ /** - * Enhanced Seccomp i386 Specific Code + * Enhanced Seccomp x86 Specific Code * * Copyright (c) 2012 Red Hat <pmoore@redhat.com> * Author: Paul Moore <pmoore@redhat.com> @@ -19,23 +19,22 @@ * along with this library; if not, see <http://www.gnu.org/licenses>. */ -#ifndef _ARCH_i386_H -#define _ARCH_i386_H +#ifndef _ARCH_X86_H +#define _ARCH_X86_H #include "arch.h" #include "db.h" #include "system.h" -#define i386_arg_count_max 6 +#define x86_arg_count_max 6 -extern const struct arch_def arch_def_i386; -extern const struct arch_syscall_def i386_syscall_table[]; +extern const struct arch_def arch_def_x86; +extern const struct arch_syscall_def x86_syscall_table[]; -int i386_syscall_rewrite(const struct arch_def *arch, unsigned int strict, - int *syscall); +int x86_syscall_rewrite(const struct arch_def *arch, unsigned int strict, + int *syscall); -int i386_filter_rewrite(const struct arch_def *arch, - unsigned int strict, - int *syscall, struct db_api_arg *chain); +int x86_filter_rewrite(const struct arch_def *arch, unsigned int strict, + int *syscall, struct db_api_arg *chain); #endif @@ -29,14 +29,14 @@ #include <seccomp.h> #include "arch.h" -#include "arch-i386.h" +#include "arch-x86.h" #include "arch-x86_64.h" #include "arch-x32.h" #include "arch-arm.h" #include "system.h" #if __i386__ -const struct arch_def *arch_def_native = &arch_def_i386; +const struct arch_def *arch_def_native = &arch_def_x86; #elif __x86_64__ #ifdef __ILP32__ const struct arch_def *arch_def_native = &arch_def_x32; @@ -80,7 +80,7 @@ static const struct arch_syscall_def *_arch_syscall_lookup(uint32_t token) { switch (token) { case SCMP_ARCH_X86: - return i386_syscall_table; + return x86_syscall_table; case SCMP_ARCH_X86_64: return x86_64_syscall_table; case SCMP_ARCH_X32: @@ -103,7 +103,7 @@ const struct arch_def *arch_def_lookup(uint32_t token) { switch (token) { case SCMP_ARCH_X86: - return &arch_def_i386; + return &arch_def_x86; case SCMP_ARCH_X86_64: return &arch_def_x86_64; case SCMP_ARCH_X32: @@ -127,7 +127,7 @@ int arch_arg_count_max(const struct arch_def *arch) { switch (arch->token) { case SCMP_ARCH_X86: - return i386_arg_count_max; + return x86_arg_count_max; case SCMP_ARCH_X86_64: return x86_64_arg_count_max; case SCMP_ARCH_X32: @@ -294,7 +294,7 @@ int arch_syscall_rewrite(const struct arch_def *arch, unsigned int strict, /* rewritable syscalls */ switch (arch->token) { case SCMP_ARCH_X86: - return i386_syscall_rewrite(arch, strict, syscall); + return x86_syscall_rewrite(arch, strict, syscall); } /* NOTE: we fall through to the default handling (strict?) if * we don't support any rewriting for the architecture */ @@ -337,8 +337,7 @@ int arch_filter_rewrite(const struct arch_def *arch, /* rewritable syscalls */ switch (arch->token) { case SCMP_ARCH_X86: - return i386_filter_rewrite(arch, - strict, syscall, chain); + return x86_filter_rewrite(arch, strict, syscall, chain); } /* NOTE: we fall through to the default handling (strict?) if * we don't support any rewriting for the architecture */ diff --git a/tools/sys_resolver.c b/tools/sys_resolver.c index dd1d0c0..5bc593e 100644 --- a/tools/sys_resolver.c +++ b/tools/sys_resolver.c @@ -26,7 +26,7 @@ #include <unistd.h> #include "../src/arch.h" -#include "../src/arch-i386.h" +#include "../src/arch-x86.h" #include "../src/arch-x86_64.h" #include "../src/arch-x32.h" #include "../src/arch-arm.h" @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) switch (opt) { case 'a': if (strcmp(optarg, "x86") == 0) - arch = &arch_def_i386; + arch = &arch_def_x86; else if (strcmp(optarg, "x86_64") == 0) arch = &arch_def_x86_64; else if (strcmp(optarg, "x32") == 0) |