#include <unistd.h>
#include "compiler.h"
+#include "config.h"
#ifndef PATH_MAX
#define PATH_MAX 4096
#define BITS_PER_TYPE(type) (sizeof(type) * 8)
#define LAST_BIT_PER_TYPE(type) (BITS_PER_TYPE(type) - 1)
+#ifndef HAVE_SYS_PERSONALITY_H
+#define PER_LINUX 0x0000
+#define PER_LINUX32 0x0008
+#endif
+
#endif /* __LXC_MACRO_H */
#endif
#endif
+#ifndef __NR_personality
+ #if defined __alpha__
+ #define __NR_personality 324
+ #elif defined __m68k__
+ #define __NR_personality 136
+ #elif defined __i386__
+ #define __NR_personality 136
+ #elif defined __x86_64__
+ #define __NR_personality 135
+ #elif defined __arm__
+ #define __NR_personality 136
+ #elif defined __aarch64__
+ #define __NR_personality 92
+ #elif defined __s390__
+ #define __NR_personality 136
+ #elif defined __powerpc__
+ #define __NR_personality 136
+ #elif defined __riscv
+ #define __NR_personality -1
+ #elif defined __sparc__
+ #define __NR_personality 191
+ #elif defined __ia64__
+ #define __NR_personality (116 + 1024)
+ #elif defined _MIPS_SIM
+ #if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */
+ #define __NR_personality (136 + 4000)
+ #endif
+ #if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */
+ #define __NR_personality (132 + 6000)
+ #endif
+ #if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */
+ #define __NR_personality (132 + 5000)
+ #endif
+ #else
+ #define -1
+ #warning "__NR_personality not defined for your architecture"
+ #endif
+#endif
+
#endif /* __LXC_SYSCALL_NUMBERS_H */
}
#endif
+#ifndef HAVE_SYS_PERSONALITY_H
+static inline int personality(unsigned long persona)
+{
+ return syscall(__NR_personality, persona);
+}
+#endif
+
#endif /* __LXC_SYSCALL_WRAPPER_H */