]> granicus.if.org Git - strace/commitdiff
Rename some functions, delete unused one. No code changes
authorDenys Vlasenko <dvlasenk@redhat.com>
Wed, 24 Aug 2011 15:53:52 +0000 (17:53 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Wed, 24 Aug 2011 15:53:52 +0000 (17:53 +0200)
* defs.h: Rename get_scno_on_sysenter() to get_scno();
delete force_result() declaration.
* strace.c (proc_open): Rename get_scno_on_sysenter() to get_scno().
* syscall.c: Rename get_scno_on_sysenter() to get_scno().
Rename get_scno_on_sysexit() to get_syscall_result().
Delete unused force_result().

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
defs.h
strace.c
syscall.c

diff --git a/defs.h b/defs.h
index bda72cb6da378f23b7a92d6ad48e0f7b18143848..89375aecc7667f64b026e6a41d3b692e510b8d50 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -587,12 +587,11 @@ extern void set_sortby(const char *);
 extern void set_overhead(int);
 extern void qualify(const char *);
 #ifdef USE_PROCFS
-extern int get_scno_on_sysenter(struct tcb *);
+extern int get_scno(struct tcb *);
 #endif
 extern long known_scno(struct tcb *);
 extern long do_ptrace(int request, struct tcb *tcp, void *addr, void *data);
 extern int ptrace_restart(int request, struct tcb *tcp, int sig);
-extern int force_result(struct tcb *, int, long);
 extern int trace_syscall(struct tcb *);
 extern void count_syscall(struct tcb *, struct timeval *);
 extern void printxval(const struct xlat *, int, const char *);
index f6a8bdb1cc2806017a37fef1cf5481a0c27f6647..04af6b568263ed5bc70a8ffb263d5f2d6ca9684d 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1488,7 +1488,7 @@ proc_open(struct tcb *tcp, int attaching)
                        }
                        if (tcp->status.PR_WHY == PR_SYSENTRY) {
                                tcp->flags &= ~TCB_INSYSCALL;
-                               get_scno_on_sysenter(tcp);
+                               get_scno(tcp);
                                if (known_scno(tcp) == SYS_execve)
                                        break;
                        }
index 8ffa4a6a24bb9800633191cac8a496813a3d89f4..3951066d1845028a174eba41bfc0cfa3b44b143c 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -748,7 +748,7 @@ struct reg regs; /* TODO: make static? */
 static
 #endif
 int
-get_scno_on_sysenter(struct tcb *tcp)
+get_scno(struct tcb *tcp)
 {
        long scno = 0;
 
@@ -1205,7 +1205,7 @@ get_scno_on_sysenter(struct tcb *tcp)
  *    ("????" etc) and bail out.
  */
 static int
-get_scno_on_sysexit(struct tcb *tcp)
+get_syscall_result(struct tcb *tcp)
 {
 #ifdef LINUX
 # if defined(S390) || defined(S390X)
@@ -1776,174 +1776,6 @@ get_error(struct tcb *tcp)
        return 1;
 }
 
-int
-force_result(struct tcb *tcp, int error, long rval)
-{
-#ifdef LINUX
-# if defined(S390) || defined(S390X)
-       gpr2 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)PT_GPR2, gpr2) < 0)
-               return -1;
-# elif defined(I386)
-       eax = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(EAX * 4), eax) < 0)
-               return -1;
-# elif defined(X86_64)
-       rax = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(RAX * 8), rax) < 0)
-               return -1;
-# elif defined(IA64)
-       if (ia32) {
-               r8 = error ? -error : rval;
-               if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R8), r8) < 0)
-                       return -1;
-       }
-       else {
-               if (error) {
-                       r8 = error;
-                       r10 = -1;
-               }
-               else {
-                       r8 = rval;
-                       r10 = 0;
-               }
-               if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R8), r8) < 0 ||
-                   ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R10), r10) < 0)
-                       return -1;
-       }
-# elif defined(BFIN)
-       r0 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)PT_R0, r0) < 0)
-               return -1;
-# elif defined(MIPS)
-       if (error) {
-               r2 = error;
-               a3 = -1;
-       }
-       else {
-               r2 = rval;
-               a3 = 0;
-       }
-       /* PTRACE_POKEUSER is OK even for n32 since rval is only a long.  */
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), a3) < 0 ||
-           ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_V0), r2) < 0)
-               return -1;
-# elif defined(POWERPC)
-       if (upeek(tcp, sizeof(unsigned long)*PT_CCR, &flags) < 0)
-               return -1;
-       if (error) {
-               flags |= SO_MASK;
-               result = error;
-       }
-       else {
-               flags &= ~SO_MASK;
-               result = rval;
-       }
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(sizeof(unsigned long)*PT_CCR), flags) < 0 ||
-           ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(sizeof(unsigned long)*PT_R3), result) < 0)
-               return -1;
-# elif defined(M68K)
-       d0 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_D0), d0) < 0)
-               return -1;
-# elif defined(ARM)
-       regs.ARM_r0 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0)
-               return -1;
-# elif defined(AVR32)
-       regs.r12 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_R12, regs.r12) < 0)
-               return -1;
-# elif defined(ALPHA)
-       if (error) {
-               a3 = -1;
-               r0 = error;
-       }
-       else {
-               a3 = 0;
-               r0 = rval;
-       }
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), a3) < 0 ||
-           ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_R0), r0) < 0)
-               return -1;
-# elif defined(SPARC)
-       if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0)
-               return -1;
-       if (error) {
-               regs.psr |= PSR_C;
-               regs.u_regs[U_REG_O0] = error;
-       }
-       else {
-               regs.psr &= ~PSR_C;
-               regs.u_regs[U_REG_O0] = rval;
-       }
-       if (ptrace(PTRACE_SETREGS, tcp->pid, (char *)&regs, 0) < 0)
-               return -1;
-# elif defined(SPARC64)
-       if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0)
-               return -1;
-       if (error) {
-               regs.tstate |= 0x1100000000UL;
-               regs.u_regs[U_REG_O0] = error;
-       }
-       else {
-               regs.tstate &= ~0x1100000000UL;
-               regs.u_regs[U_REG_O0] = rval;
-       }
-       if (ptrace(PTRACE_SETREGS, tcp->pid, (char *)&regs, 0) < 0)
-               return -1;
-# elif defined(HPPA)
-       r28 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GR28), r28) < 0)
-               return -1;
-# elif defined(SH)
-       r0 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*REG_REG0), r0) < 0)
-               return -1;
-# elif defined(SH64)
-       r9 = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_GENERAL(9), r9) < 0)
-               return -1;
-# endif
-#endif /* LINUX */
-
-#ifdef SUNOS4
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)uoff(u_error),
-                  error << 24) < 0 ||
-           ptrace(PTRACE_POKEUSER, tcp->pid, (char*)uoff(u_rval1), rval) < 0)
-               return -1;
-#endif /* SUNOS4 */
-
-#ifdef SVR4
-       /* XXX no clue */
-       return -1;
-#endif /* SVR4 */
-
-#ifdef FREEBSD
-       if (pread(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) {
-               perror("pread");
-               return -1;
-       }
-       if (error) {
-               regs.r_eflags |= PSL_C;
-               regs.r_eax = error;
-       }
-       else {
-               regs.r_eflags &= ~PSL_C;
-               regs.r_eax = rval;
-       }
-       if (pwrite(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) {
-               perror("pwrite");
-               return -1;
-       }
-#endif /* FREEBSD */
-
-       /* All branches reach here on success (only).  */
-       tcp->u_error = error;
-       tcp->u_rval = rval;
-       return 0;
-}
-
 static int
 syscall_enter(struct tcb *tcp)
 {
@@ -2224,7 +2056,7 @@ trace_syscall_entering(struct tcb *tcp)
        }
 #endif
 
-       scno_good = res = get_scno_on_sysenter(tcp);
+       scno_good = res = get_scno(tcp);
        if (res == 0)
                return res;
        if (res == 1)
@@ -2393,7 +2225,7 @@ trace_syscall_exiting(struct tcb *tcp)
        if (dtime || cflag)
                gettimeofday(&tv, NULL);
 
-       scno_good = res = get_scno_on_sysexit(tcp);
+       scno_good = res = get_syscall_result(tcp);
        if (res == 0)
                return res;
        if (res == 1)