if (i)
fprintf(outf,
"System call usage summary for %u bit mode:\n",
- personality_wordsize[current_personality] * 8);
+ current_wordsize * 8);
call_summary_pers(outf);
}
# define PERSONALITY1_WORDSIZE 4
#endif
+#ifndef PERSONALITY0_WORDSIZE
+# define PERSONALITY0_WORDSIZE sizeof(long)
+#endif
+
#if !HAVE_DECL_PTRACE_SETOPTIONS
# define PTRACE_SETOPTIONS 0x4200
#endif
void perror_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
void die_out_of_memory(void) __attribute__ ((noreturn));
-extern void set_personality(int personality);
extern const char *xlookup(const struct xlat *, int);
extern void set_sortby(const char *);
#define printtv_special(tcp, addr) \
printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1)
+#if SUPPORTED_PERSONALITIES > 1
+extern void set_personality(int personality);
extern int current_personality;
extern const int personality_wordsize[];
+# define current_wordsize (personality_wordsize[current_personality])
+#else
+# define set_personality(personality) ((void)0)
+# define current_personality 0
+# define current_wordsize PERSONALITY0_WORDSIZE
+#endif
struct sysent {
unsigned nargs;
struct flock fl;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] != sizeof(fl.l_start)) {
- if (personality_wordsize[current_personality] == 4) {
+ if (current_wordsize != sizeof(fl.l_start)) {
+ if (current_wordsize == 4) {
/* 32-bit x86 app on x86_64 and similar cases */
struct {
short int l_type;
} else {
/* let people know we have a problem here */
tprintf("{ <decode error: unsupported wordsize %d> }",
- personality_wordsize[current_personality]);
+ current_wordsize);
return;
}
} else
long utl[2];
int uti[2];
} u;
- unsigned wordsize = personality_wordsize[current_personality];
+ unsigned wordsize = current_wordsize;
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
struct { u_int64_t base; u_int64_t len; } iov64;
} iov;
#define sizeof_iov \
- (personality_wordsize[current_personality] == 4 \
- ? sizeof(iov.iov32) : sizeof(iov.iov64))
+ (current_wordsize == 4 ? sizeof(iov.iov32) : sizeof(iov.iov64))
#define iov_iov_base \
- (personality_wordsize[current_personality] == 4 \
- ? (u_int64_t) iov.iov32.base : iov.iov64.base)
+ (current_wordsize == 4 ? (uint64_t) iov.iov32.base : iov.iov64.base)
#define iov_iov_len \
- (personality_wordsize[current_personality] == 4 \
- ? (u_int64_t) iov.iov32.len : iov.iov64.len)
+ (current_wordsize == 4 ? (uint64_t) iov.iov32.len : iov.iov64.len)
#else
struct iovec iov;
#define sizeof_iov sizeof(iov)
} cp;
const char *sep;
int n = 0;
- unsigned wordsize = personality_wordsize[current_personality];
+ unsigned wordsize = current_wordsize;
cp.p64 = 1;
for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) {
# if SIZEOF_RLIM_T == 4
print_rlimit32(tcp, addr);
# else
- if (personality_wordsize[current_personality] == 4)
+ if (current_wordsize == 4)
print_rlimit32(tcp, addr);
else
print_rlimit64(tcp, addr);
long pid = tcp->u_arg[0];
#if SUPPORTED_PERSONALITIES > 1
/* Sign-extend a 32-bit value when that's what it is. */
- if (personality_wordsize[current_personality] < sizeof pid)
+ if (current_wordsize < sizeof pid)
pid = (long) (int) pid;
#endif
tprintf("%ld, %s", pid, signame(tcp->u_arg[1]));
}
#if SUPPORTED_PERSONALITIES > 1
#if SIZEOF_LONG > 4
- if (personality_wordsize[current_personality] != sizeof(sa.sa_flags)
- && personality_wordsize[current_personality] == 4) {
+ if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) {
struct new_sigaction32 sa32;
r = umove(tcp, addr, &sa32);
if (r >= 0) {
int qual_flags2[MAX_QUALS];
#endif
-const struct sysent *sysent;
-const char *const *errnoent;
-const char *const *signalent;
-const struct ioctlent *ioctlent;
-unsigned nsyscalls;
-unsigned nerrnos;
-unsigned nsignals;
-unsigned nioctlents;
-int *qual_flags;
+const struct sysent *sysent = sysent0;
+const char *const *errnoent = errnoent0;
+const char *const *signalent = signalent0;
+const struct ioctlent *ioctlent = ioctlent0;
+unsigned nsyscalls = nsyscalls0;
+unsigned nerrnos = nerrnos0;
+unsigned nsignals = nsignals0;
+unsigned nioctlents = nioctlents0;
+int *qual_flags = qual_flags0;
+#if SUPPORTED_PERSONALITIES > 1
int current_personality;
-#ifndef PERSONALITY0_WORDSIZE
-# define PERSONALITY0_WORDSIZE sizeof(long)
-#endif
const int personality_wordsize[SUPPORTED_PERSONALITIES] = {
PERSONALITY0_WORDSIZE,
-#if SUPPORTED_PERSONALITIES > 1
PERSONALITY1_WORDSIZE,
-#endif
-#if SUPPORTED_PERSONALITIES > 2
+# if SUPPORTED_PERSONALITIES > 2
PERSONALITY2_WORDSIZE,
-#endif
+# endif
};
void
qual_flags = qual_flags0;
break;
-#if SUPPORTED_PERSONALITIES >= 2
case 1:
errnoent = errnoent1;
nerrnos = nerrnos1;
nsignals = nsignals1;
qual_flags = qual_flags1;
break;
-#endif
-#if SUPPORTED_PERSONALITIES >= 3
+# if SUPPORTED_PERSONALITIES >= 3
case 2:
errnoent = errnoent2;
nerrnos = nerrnos2;
nsignals = nsignals2;
qual_flags = qual_flags2;
break;
-#endif
+# endif
}
current_personality = personality;
}
-#if SUPPORTED_PERSONALITIES > 1
static void
update_personality(struct tcb *tcp, int personality)
{
tcp->scno = SYS_socket_subcall + tcp->u_arg[0];
addr = tcp->u_arg[1];
tcp->u_nargs = sysent[tcp->scno].nargs;
- size = personality_wordsize[current_personality];
+ size = current_wordsize;
for (i = 0; i < tcp->u_nargs; ++i) {
if (size == sizeof(int)) {
unsigned int arg;
* other: error, trace_syscall() should print error indicator
* ("????" etc) and bail out.
*/
-static
-int
+static int
get_scno(struct tcb *tcp)
{
long scno = 0;
{
unsigned long int max = -(long int) nerrnos;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] < sizeof(val)) {
+ if (current_wordsize < sizeof(val)) {
val = (unsigned int) val;
max = (unsigned int) max;
}
if (bitness == BITNESS_32
#if SUPPORTED_PERSONALITIES > 1
- || personality_wordsize[current_personality] == 4
+ || current_wordsize == 4
#endif
)
{
int rc;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] == 4) {
+ if (current_wordsize == 4) {
struct timeval32 tv;
rc = umove(tcp, addr, &tv);
if (bitness == BITNESS_32
#if SUPPORTED_PERSONALITIES > 1
- || personality_wordsize[current_personality] == 4
+ || current_wordsize == 4
#endif
)
{
struct timex tx;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] == 4)
+ if (current_wordsize == 4)
return tprint_timex32(tcp, addr);
#endif
if (umove(tcp, addr, &tx) < 0)
struct sigevent sev;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] == 4) {
+ if (current_wordsize == 4) {
printsigevent32(tcp, arg);
return;
}
} iovu;
#define iov iovu.iov64
#define sizeof_iov \
- (personality_wordsize[current_personality] == 4 \
- ? sizeof(*iovu.iov32) : sizeof(*iovu.iov64))
+ (current_wordsize == 4 ? sizeof(*iovu.iov32) : sizeof(*iovu.iov64))
#define iov_iov_base(i) \
- (personality_wordsize[current_personality] == 4 \
- ? (u_int64_t) iovu.iov32[i].base : iovu.iov64[i].base)
+ (current_wordsize == 4 ? (uint64_t) iovu.iov32[i].base : iovu.iov64[i].base)
#define iov_iov_len(i) \
- (personality_wordsize[current_personality] == 4 \
- ? (u_int64_t) iovu.iov32[i].len : iovu.iov64[i].len)
+ (current_wordsize == 4 ? (uint64_t) iovu.iov32[i].len : iovu.iov64[i].len)
#else
struct iovec *iov;
#define sizeof_iov sizeof(*iov)
} u;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] < sizeof(addr))
- addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1;
+ if (current_wordsize < sizeof(addr))
+ addr &= (1ul << 8 * current_wordsize) - 1;
#endif
if (!process_vm_readv_not_supported) {
} u;
#if SUPPORTED_PERSONALITIES > 1
- if (personality_wordsize[current_personality] < sizeof(addr))
- addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1;
+ if (current_wordsize < sizeof(addr))
+ addr &= (1ul << 8 * current_wordsize) - 1;
#endif
if (!process_vm_readv_not_supported) {