From ac8241cd4fcee01a3a3bc0b9d9f27c0efd0906a8 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Sat, 20 Jan 2018 04:51:29 +0100 Subject: [PATCH] Move definition of personality macros to arch_defs_.h * supported_personalities.h: Remove. * defs.h: Do not include it. * linux/arch_defs_.h [!DEFAULT_PERSONALITY] (DEFAULT_PERSONALITY): New macro. [!SUPPORTED_PERSONALITIES] (SUPPORTED_PERSONALITIES): Likewise. * linux/aarch64/arch_defs_.h (SUPPORTED_PERSONALITIES): New macro. * linux/riscv/arch_defs_.h: Likewise. * linux/s390x/arch_defs_.h: Likewise. * linux/sparc64/arch_defs_.h: Likewise. * linux/x32/arch_defs_.h: Likewise. * linux/x86_64/arch_defs_.h: Likewise. * linux/powerpc64/arch_defs_.h: New file. * linux/tile/arch_defs_.h: Likewise. * Makefile.am (EXTRA_DIST): Add them. (strace_SOURCES): Remove supported_personalities.h. Co-Authored-by: Dmitry V. Levin --- Makefile.am | 3 ++- defs.h | 1 - linux/aarch64/arch_defs_.h | 1 + linux/arch_defs_.h | 8 ++++++ linux/powerpc64/arch_defs_.h | 1 + linux/riscv/arch_defs_.h | 1 + linux/s390x/arch_defs_.h | 1 + linux/sparc64/arch_defs_.h | 1 + linux/tile/arch_defs_.h | 5 ++++ linux/x32/arch_defs_.h | 1 + linux/x86_64/arch_defs_.h | 1 + supported_personalities.h | 51 ------------------------------------ 12 files changed, 22 insertions(+), 53 deletions(-) create mode 100644 linux/powerpc64/arch_defs_.h create mode 100644 linux/tile/arch_defs_.h delete mode 100644 supported_personalities.h diff --git a/Makefile.am b/Makefile.am index d07a9b80..e584bea2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -294,7 +294,6 @@ strace_SOURCES = \ strace.c \ string_to_uint.h \ string_to_uint.c \ - supported_personalities.h \ swapon.c \ syscall.c \ sysctl.c \ @@ -658,6 +657,7 @@ EXTRA_DIST = \ linux/powerpc/set_scno.c \ linux/powerpc/syscallent.h \ linux/powerpc/userent.h \ + linux/powerpc64/arch_defs_.h \ linux/powerpc64/arch_regs.c \ linux/powerpc64/arch_regs.h \ linux/powerpc64/arch_rt_sigframe.c\ @@ -812,6 +812,7 @@ EXTRA_DIST = \ linux/sparc64/userent.h \ linux/subcall.h \ linux/syscall.h \ + linux/tile/arch_defs_.h \ linux/tile/arch_regs.c \ linux/tile/arch_regs.h \ linux/tile/arch_rt_sigframe.c \ diff --git a/defs.h b/defs.h index b4450ba8..6f4c5e85 100644 --- a/defs.h +++ b/defs.h @@ -60,7 +60,6 @@ #include "macros.h" #include "mpers_type.h" #include "string_to_uint.h" -#include "supported_personalities.h" #include "sysent.h" #include "xmalloc.h" diff --git a/linux/aarch64/arch_defs_.h b/linux/aarch64/arch_defs_.h index 4d264a1d..ad9748ab 100644 --- a/linux/aarch64/arch_defs_.h +++ b/linux/aarch64/arch_defs_.h @@ -1,2 +1,3 @@ #define HAVE_ARCH_OLD_MMAP 1 #define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/arch_defs_.h b/linux/arch_defs_.h index af6625ed..c2aa62f8 100644 --- a/linux/arch_defs_.h +++ b/linux/arch_defs_.h @@ -15,3 +15,11 @@ #ifndef HAVE_ARCH_UID16_SYSCALLS # define HAVE_ARCH_UID16_SYSCALLS 0 #endif + +#ifndef DEFAULT_PERSONALITY +# define DEFAULT_PERSONALITY 0 +#endif + +#ifndef SUPPORTED_PERSONALITIES +# define SUPPORTED_PERSONALITIES 1 +#endif diff --git a/linux/powerpc64/arch_defs_.h b/linux/powerpc64/arch_defs_.h new file mode 100644 index 00000000..640d68e0 --- /dev/null +++ b/linux/powerpc64/arch_defs_.h @@ -0,0 +1 @@ +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/riscv/arch_defs_.h b/linux/riscv/arch_defs_.h index 0c9ca195..33494f5d 100644 --- a/linux/riscv/arch_defs_.h +++ b/linux/riscv/arch_defs_.h @@ -1 +1,2 @@ #define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/s390x/arch_defs_.h b/linux/s390x/arch_defs_.h index 59fee837..bed2f2d6 100644 --- a/linux/s390x/arch_defs_.h +++ b/linux/s390x/arch_defs_.h @@ -1,3 +1,4 @@ #define HAVE_ARCH_OLD_MMAP 1 #define HAVE_ARCH_OLD_MMAP_PGOFF 1 #define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/sparc64/arch_defs_.h b/linux/sparc64/arch_defs_.h index 5240c363..800d6727 100644 --- a/linux/sparc64/arch_defs_.h +++ b/linux/sparc64/arch_defs_.h @@ -1,3 +1,4 @@ #define HAVE_ARCH_GETRVAL2 1 #define HAVE_ARCH_UID16_SYSCALLS 1 #define HAVE_ARCH_SA_RESTORER 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/tile/arch_defs_.h b/linux/tile/arch_defs_.h new file mode 100644 index 00000000..34a56248 --- /dev/null +++ b/linux/tile/arch_defs_.h @@ -0,0 +1,5 @@ +#define SUPPORTED_PERSONALITIES 2 + +#ifdef __tilepro__ +# define DEFAULT_PERSONALITY 1 +#endif diff --git a/linux/x32/arch_defs_.h b/linux/x32/arch_defs_.h index 4d264a1d..ad9748ab 100644 --- a/linux/x32/arch_defs_.h +++ b/linux/x32/arch_defs_.h @@ -1,2 +1,3 @@ #define HAVE_ARCH_OLD_MMAP 1 #define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/x86_64/arch_defs_.h b/linux/x86_64/arch_defs_.h index 4d264a1d..1401c6a8 100644 --- a/linux/x86_64/arch_defs_.h +++ b/linux/x86_64/arch_defs_.h @@ -1,2 +1,3 @@ #define HAVE_ARCH_OLD_MMAP 1 #define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 3 diff --git a/supported_personalities.h b/supported_personalities.h deleted file mode 100644 index 58ee0278..00000000 --- a/supported_personalities.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2001-2017 The strace developers. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef STRACE_SUPPORTED_PERSONALITIES_H -#define STRACE_SUPPORTED_PERSONALITIES_H - -#if defined X86_64 -# define SUPPORTED_PERSONALITIES 3 -#elif defined AARCH64 \ - || defined POWERPC64 \ - || defined RISCV \ - || defined S390X \ - || defined SPARC64 \ - || defined TILE \ - || defined X32 -# define SUPPORTED_PERSONALITIES 2 -#else -# define SUPPORTED_PERSONALITIES 1 -#endif - -#if defined TILE && defined __tilepro__ -# define DEFAULT_PERSONALITY 1 -#else -# define DEFAULT_PERSONALITY 0 -#endif - -#endif /* !STRACE_SUPPORTED_PERSONALITIES_H */