int pid; /* If 0, this tcb is free */
int qual_flg; /* qual_flags[scno] or DEFAULT_QUAL_FLAGS + RAW */
unsigned long u_error; /* Error code */
- long scno; /* System call number */
+ kernel_scno_t scno; /* System call number */
long u_arg[MAX_ARGS]; /* System call arguments */
#if HAVE_STRUCT_TCB_EXT_ARG
long long ext_arg[MAX_ARGS];
* @return String literal corresponding to the syscall number in case latter
* is valid; NULL otherwise.
*/
-extern const char *syscall_name(long scno);
+extern const char *syscall_name(kernel_scno_t scno);
extern const char *err_name(unsigned long err);
extern bool is_erestart(struct tcb *);
/* Checks that sysent[scno] is not out of range. */
static inline bool
-scno_in_range(unsigned long scno)
+scno_in_range(kernel_scno_t scno)
{
return scno < nsyscalls;
}
* and its sysent[scno].sys_flags has no TRACE_INDIRECT_SUBCALL flag set.
*/
static inline bool
-scno_is_valid(unsigned long scno)
+scno_is_valid(kernel_scno_t scno)
{
return scno_in_range(scno)
&& sysent[scno].sys_func
# endif
+typedef unsigned long kernel_scno_t;
+
typedef struct {
kernel_ulong_t d_ino;
kernel_ulong_t d_off;
static int
arch_get_scno(struct tcb *tcp)
{
- long scno = 0;
+ kernel_scno_t scno = 0;
switch (aarch64_io.iov_len) {
case sizeof(aarch64_regs):
*/
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
unsigned int n = (uint16_t) scno;
const struct iovec io = {
static int
arch_get_scno(struct tcb *tcp)
{
- long scno = 0;
+ kernel_scno_t scno = 0;
if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0)
return -1;
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, REG_R0, scno);
}
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
arc_regs.scratch.r8 = scno;
return set_regs(tcp->pid);
static int
arch_get_scno(struct tcb *tcp)
{
- long scno = 0;
+ kernel_scno_t scno = 0;
/* Note: we support only 32-bit CPUs, not 26-bit */
if (errno)
return -1;
/* EABI syscall convention? */
- if ((unsigned long) scno != 0xef000000) {
+ if (scno != 0xef000000) {
/* No, it's OABI */
if ((scno & 0x0ff00000) != 0x0f900000) {
error_msg("pid %d unknown syscall trap 0x%08lx",
*/
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
unsigned int n = (uint16_t) scno;
int rc = ptrace(PTRACE_SET_SYSCALL, tcp->pid, NULL, (unsigned long) n);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
avr32_regs.r8 = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, PT_ORIG_P0, scno);
}
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, 4 * PT_R9, scno);
}
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, PT_GR20, scno);
}
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
#ifdef HAVE_GETREGS_OLD
return upoke(tcp->pid, 4 * ORIG_EAX, scno);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
if (ia64_ia32mode)
ia64_regs.gr[0] = scno;
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
m68k_regs.orig_d0 = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
metag_regs.dx[0][1] = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, 0, scno);
}
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
mips_REG_V0 = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
nios2_regs.regs[2] = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
or1k_regs.gpr[11] = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
#ifdef HAVE_GETREGS_OLD
return upoke(tcp->pid, sizeof(long) * PT_R0, scno);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
riscv_regs.a7 = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
s390_regset.gprs[2] = scno;
return set_regs(tcp->pid);
static int
arch_get_scno(struct tcb *tcp)
{
- long scno = 0;
+ kernel_scno_t scno = 0;
/*
* In the new syscall ABI, the system call number is in R3.
if (upeek(tcp->pid, 4*(REG_REG0+3), &scno) < 0)
return -1;
- if (scno < 0) {
+ if ((long) scno < 0) {
/* Odd as it may seem, a glibc bug has been known to cause
glibc to issue bogus negative syscall numbers. So for
our purposes, make strace print what it *should* have been */
- long correct_scno = (scno & 0xff);
+ kernel_scno_t correct_scno = (scno & 0xff);
if (debug_flag)
error_msg("Detected glibc bug: bogus system call"
" number = %ld, correcting to %ld",
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, 4 * (REG_REG0 + 3), scno);
}
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, REG_SYSCALL, scno);
}
*/
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
sparc_regs.u_regs[U_REG_G1] = scno;
return set_regs(tcp->pid);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
tile_regs.regs[10] = scno;
return set_regs(tcp->pid);
static int
arch_get_scno(struct tcb *tcp)
{
- long scno = 0;
+ kernel_scno_t scno = 0;
unsigned int currpers;
#ifndef __X32_SYSCALL_BIT
#endif /* !HAVE_GETREGS_OLD */
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
#ifdef HAVE_GETREGS_OLD
return upoke(tcp->pid, 8 * ORIG_RAX, scno);
static int
-arch_set_scno(struct tcb *tcp, long scno)
+arch_set_scno(struct tcb *tcp, kernel_scno_t scno)
{
return upoke(tcp->pid, SYSCALL_NR, scno);
}
if (call < 1 || call >= SYS_socket_nsubcalls)
return;
- const unsigned long scno = SYS_socket_subcall + call;
+ const kernel_scno_t scno = SYS_socket_subcall + call;
const unsigned int nargs = sysent[scno].nargs;
uint64_t buf[nargs];
* Shuffle syscall numbers so that we don't have huge gaps in syscall table.
* The shuffling should be an involution: shuffle_scno(shuffle_scno(n)) == n.
*/
-#if defined(ARM) || defined(AARCH64) /* So far only 32-bit ARM needs this */
-static long
-shuffle_scno(unsigned long scno)
+static kernel_scno_t
+shuffle_scno(kernel_scno_t scno)
{
+#if defined(ARM) || defined(AARCH64) /* So far only 32-bit ARM needs this */
if (scno < ARM_FIRST_SHUFFLED_SYSCALL)
return scno;
if (scno == 0x000ffff0)
return ARM_FIRST_SHUFFLED_SYSCALL;
-#define ARM_SECOND_SHUFFLED_SYSCALL (ARM_FIRST_SHUFFLED_SYSCALL + 1)
+# define ARM_SECOND_SHUFFLED_SYSCALL (ARM_FIRST_SHUFFLED_SYSCALL + 1)
/*
* Is it ARM specific syscall?
* Swap [0x000f0000, 0x000f0000 + LAST_SPECIAL] range
if (scno <= ARM_SECOND_SHUFFLED_SYSCALL + ARM_LAST_SPECIAL_SYSCALL) {
return scno + 0x000f0000 - ARM_SECOND_SHUFFLED_SYSCALL;
}
+#endif /* ARM || AARCH64 */
return scno;
}
-#else
-# define shuffle_scno(scno) ((long)(scno))
-#endif
const char *
err_name(unsigned long err)
static int get_syscall_args(struct tcb *);
static int get_syscall_result(struct tcb *);
static int arch_get_scno(struct tcb *tcp);
-static int arch_set_scno(struct tcb *, long);
+static int arch_set_scno(struct tcb *, kernel_scno_t);
static void get_error(struct tcb *, const bool);
static int arch_set_error(struct tcb *);
#endif
const char *
-syscall_name(long scno)
+syscall_name(kernel_scno_t scno)
{
#if defined X32_PERSONALITY_NUMBER && defined __X32_SYSCALL_BIT
if (current_personality == X32_PERSONALITY_NUMBER)