Change the first argument of upoke from pid to tcp
Users were updated automatically by: for i in `git grep -l 'upoke(tcp->pid'`; do \ sed -i 's/upoke(tcp->pid/upoke(tcp/g' "$i"; \ done * upoke.c (upoke): Change the first argument from pid_t pid to struct tcb *tcp. Use tcp->pid instead of pid in the function's body. * defs.h (upoke): Update declaration. * linux/alpha/set_error.c (arch_set_error, arch_set_success): Provide tcp in the first argument of the upoke call instead of tcp->pid. * linux/alpha/set_scno.c (arch_set_scno): Likewise. * linux/bfin/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/bfin/set_scno.c (arch_set_scno): Likewise. * linux/crisv10/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/crisv10/set_scno.c (arch_set_scno): Likewise. * linux/hppa/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/hppa/set_scno.c (arch_set_scno): Likewise. * linux/i386/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/i386/set_scno.c (arch_set_scno): Likewise. * linux/microblaze/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/microblaze/set_scno.c (arch_set_scno): Likewise. * linux/powerpc/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/powerpc/set_scno.c (arch_set_scno): Likewise. * linux/sh/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/sh/set_scno.c (arch_set_scno): Likewise. * linux/sh64/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/sh64/set_scno.c (arch_set_scno): Likewise. * linux/x86_64/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/x86_64/set_scno.c (arch_set_scno): Likewise. * linux/xtensa/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/xtensa/set_scno.c (arch_set_scno): Likewise.
This commit is contained in:
parent
0b786d6641
commit
08e2fd253a
2
defs.h
2
defs.h
@ -451,7 +451,7 @@ extern int
|
||||
umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr);
|
||||
|
||||
extern int upeek(int pid, unsigned long, kernel_ulong_t *);
|
||||
extern int upoke(int pid, unsigned long, kernel_ulong_t);
|
||||
extern int upoke(struct tcb *tcp, unsigned long, kernel_ulong_t);
|
||||
|
||||
extern bool
|
||||
print_array(struct tcb *,
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
alpha_r0 = tcp->u_error;
|
||||
return upoke(tcp->pid, REG_R0, alpha_r0);
|
||||
return upoke(tcp, REG_R0, alpha_r0);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
return upoke(tcp->pid, REG_A3, (alpha_a3 = 0))
|
||||
|| upoke(tcp->pid, REG_R0, (alpha_r0 = tcp->u_rval));
|
||||
return upoke(tcp, REG_A3, (alpha_a3 = 0))
|
||||
|| upoke(tcp, REG_R0, (alpha_r0 = tcp->u_rval));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, REG_R0, scno);
|
||||
return upoke(tcp, REG_R0, scno);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
bfin_r0 = -tcp->u_error;
|
||||
return upoke(tcp->pid, PT_R0, bfin_r0);
|
||||
return upoke(tcp, PT_R0, bfin_r0);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
bfin_r0 = tcp->u_rval;
|
||||
return upoke(tcp->pid, PT_R0, bfin_r0);
|
||||
return upoke(tcp, PT_R0, bfin_r0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, PT_ORIG_P0, scno);
|
||||
return upoke(tcp, PT_ORIG_P0, scno);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
cris_r10 = -tcp->u_error;
|
||||
return upoke(tcp->pid, 4 * PT_R10, cris_r10);
|
||||
return upoke(tcp, 4 * PT_R10, cris_r10);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
cris_r10 = tcp->u_rval;
|
||||
return upoke(tcp->pid, 4 * PT_R10, cris_r10);
|
||||
return upoke(tcp, 4 * PT_R10, cris_r10);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, 4 * PT_R9, scno);
|
||||
return upoke(tcp, 4 * PT_R9, scno);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
hppa_r28 = -tcp->u_error;
|
||||
return upoke(tcp->pid, PT_GR28, hppa_r28);
|
||||
return upoke(tcp, PT_GR28, hppa_r28);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
hppa_r28 = tcp->u_rval;
|
||||
return upoke(tcp->pid, PT_GR28, hppa_r28);
|
||||
return upoke(tcp, PT_GR28, hppa_r28);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, PT_GR20, scno);
|
||||
return upoke(tcp, PT_GR20, scno);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
i386_regs.eax = -tcp->u_error;
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, 4 * EAX, i386_regs.eax);
|
||||
return upoke(tcp, 4 * EAX, i386_regs.eax);
|
||||
#else
|
||||
return set_regs(tcp->pid);
|
||||
#endif
|
||||
@ -14,7 +14,7 @@ arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
i386_regs.eax = tcp->u_rval;
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, 4 * EAX, i386_regs.eax);
|
||||
return upoke(tcp, 4 * EAX, i386_regs.eax);
|
||||
#else
|
||||
return set_regs(tcp->pid);
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@ static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, 4 * ORIG_EAX, scno);
|
||||
return upoke(tcp, 4 * ORIG_EAX, scno);
|
||||
#else
|
||||
i386_regs.orig_eax = scno;
|
||||
return set_regs(tcp->pid);
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
microblaze_r3 = -tcp->u_error;
|
||||
return upoke(tcp->pid, 3 * 4, microblaze_r3);
|
||||
return upoke(tcp, 3 * 4, microblaze_r3);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
microblaze_r3 = tcp->u_rval;
|
||||
return upoke(tcp->pid, 3 * 4, microblaze_r3);
|
||||
return upoke(tcp, 3 * 4, microblaze_r3);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, 0, scno);
|
||||
return upoke(tcp, 0, scno);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
ppc_regs.gpr[3] = tcp->u_error;
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
|
||||
return upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
|
||||
#else
|
||||
return set_regs(tcp->pid);
|
||||
#endif
|
||||
@ -15,8 +15,8 @@ arch_set_success(struct tcb *tcp)
|
||||
ppc_regs.gpr[3] = tcp->u_rval;
|
||||
ppc_regs.ccr &= ~0x10000000;
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, sizeof(long) * PT_CCR, ppc_regs.ccr) ||
|
||||
upoke(tcp->pid, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
|
||||
return upoke(tcp, sizeof(long) * PT_CCR, ppc_regs.ccr) ||
|
||||
upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
|
||||
#else
|
||||
return set_regs(tcp->pid);
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@ static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, sizeof(long) * PT_R0, scno);
|
||||
return upoke(tcp, sizeof(long) * PT_R0, scno);
|
||||
#else
|
||||
ppc_regs.gpr[0] = scno;
|
||||
return set_regs(tcp->pid);
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
sh_r0 = -tcp->u_error;
|
||||
return upoke(tcp->pid, 4 * REG_REG0, sh_r0);
|
||||
return upoke(tcp, 4 * REG_REG0, sh_r0);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
sh_r0 = tcp->u_rval;
|
||||
return upoke(tcp->pid, 4 * REG_REG0, sh_r0);
|
||||
return upoke(tcp, 4 * REG_REG0, sh_r0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, 4 * (REG_REG0 + 3), scno);
|
||||
return upoke(tcp, 4 * (REG_REG0 + 3), scno);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
sh64_r9 = -tcp->u_error;
|
||||
return upoke(tcp->pid, REG_GENERAL(9), sh64_r9);
|
||||
return upoke(tcp, REG_GENERAL(9), sh64_r9);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
sh64_r9 = tcp->u_rval;
|
||||
return upoke(tcp->pid, REG_GENERAL(9), sh64_r9);
|
||||
return upoke(tcp, REG_GENERAL(9), sh64_r9);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, REG_SYSCALL, scno);
|
||||
return upoke(tcp, REG_SYSCALL, scno);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
x86_64_regs.rax = -(long long) tcp->u_error;
|
||||
return upoke(tcp->pid, 8 * RAX, x86_64_regs.rax);
|
||||
return upoke(tcp, 8 * RAX, x86_64_regs.rax);
|
||||
#else
|
||||
if (x86_io.iov_len == sizeof(i386_regs))
|
||||
return i386_set_error(tcp);
|
||||
@ -26,7 +26,7 @@ arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
x86_64_regs.rax = (long long) tcp->u_rval;
|
||||
return upoke(tcp->pid, 8 * RAX, x86_64_regs.rax);
|
||||
return upoke(tcp, 8 * RAX, x86_64_regs.rax);
|
||||
#else
|
||||
if (x86_io.iov_len == sizeof(i386_regs))
|
||||
return i386_set_success(tcp);
|
||||
|
@ -8,7 +8,7 @@ static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
#ifdef HAVE_GETREGS_OLD
|
||||
return upoke(tcp->pid, 8 * ORIG_RAX, scno);
|
||||
return upoke(tcp, 8 * ORIG_RAX, scno);
|
||||
#else
|
||||
if (x86_io.iov_len == sizeof(i386_regs))
|
||||
return i386_set_scno(tcp, scno);
|
||||
|
@ -2,12 +2,12 @@ static int
|
||||
arch_set_error(struct tcb *tcp)
|
||||
{
|
||||
xtensa_a2 = -tcp->u_error;
|
||||
return upoke(tcp->pid, REG_A_BASE + 2, xtensa_a2);
|
||||
return upoke(tcp, REG_A_BASE + 2, xtensa_a2);
|
||||
}
|
||||
|
||||
static int
|
||||
arch_set_success(struct tcb *tcp)
|
||||
{
|
||||
xtensa_a2 = tcp->u_rval;
|
||||
return upoke(tcp->pid, REG_A_BASE + 2, xtensa_a2);
|
||||
return upoke(tcp, REG_A_BASE + 2, xtensa_a2);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
static int
|
||||
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
|
||||
{
|
||||
return upoke(tcp->pid, SYSCALL_NR, scno);
|
||||
return upoke(tcp, SYSCALL_NR, scno);
|
||||
}
|
||||
|
7
upoke.c
7
upoke.c
@ -29,11 +29,12 @@
|
||||
#include "ptrace.h"
|
||||
|
||||
int
|
||||
upoke(int pid, unsigned long off, kernel_ulong_t val)
|
||||
upoke(struct tcb *tcp, unsigned long off, kernel_ulong_t val)
|
||||
{
|
||||
if (ptrace(PTRACE_POKEUSER, pid, off, val)) {
|
||||
if (ptrace(PTRACE_POKEUSER, tcp->pid, off, val)) {
|
||||
if (errno != ESRCH)
|
||||
perror_msg("upoke: PTRACE_POKEUSER pid:%d @%#lx)", pid, off);
|
||||
perror_msg("upoke: PTRACE_POKEUSER pid:%d @%#lx)",
|
||||
tcp->pid, off);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user