From 4c1963836fd96909c2d86315d4972b5b0075edf6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 4 Jan 2012 15:11:09 +0100 Subject: [PATCH] Remove sig parameter from detach() * strace.c (detach): Drop sig parameter - it is zero in all calls. (cleanup): Don't pass sig = 0 to detach() call. (detach): Ditto. Signed-off-by: Denys Vlasenko --- strace.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/strace.c b/strace.c index 2e963059..463ce1ff 100644 --- a/strace.c +++ b/strace.c @@ -128,7 +128,7 @@ static struct tcb **tcbtab; static unsigned int nprocs, tcbtabsize; static const char *progname; -static int detach(struct tcb *tcp, int sig); +static int detach(struct tcb *tcp); static int trace(void); static void cleanup(void); static void interrupt(int sig); @@ -1669,7 +1669,7 @@ droptcb(struct tcb *tcp) would SIGSTOP it and wait for its SIGSTOP notification forever. */ static int -detach(struct tcb *tcp, int sig) +detach(struct tcb *tcp) { int error = 0; #ifdef LINUX @@ -1695,7 +1695,7 @@ detach(struct tcb *tcp, int sig) * would be left stopped (process state T). */ catch_sigstop = (tcp->flags & TCB_IGNORE_ONE_SIGSTOP); - error = ptrace(PTRACE_DETACH, tcp->pid, (char *) 1, sig); + error = ptrace(PTRACE_DETACH, tcp->pid, (char *) 1, 0); if (error == 0) { /* On a clear day, you can see forever. */ } @@ -1748,7 +1748,7 @@ detach(struct tcb *tcp, int sig) break; } if (WSTOPSIG(status) == SIGSTOP) { - ptrace_restart(PTRACE_DETACH, tcp, sig); + ptrace_restart(PTRACE_DETACH, tcp, 0); break; } error = ptrace_restart(PTRACE_CONT, tcp, @@ -1762,10 +1762,7 @@ detach(struct tcb *tcp, int sig) #if defined(SUNOS4) /* PTRACE_DETACH won't respect `sig' argument, so we post it here. */ - if (sig && kill(tcp->pid, sig) < 0) - perror("detach: kill"); - sig = 0; - error = ptrace_restart(PTRACE_DETACH, tcp, sig); + error = ptrace_restart(PTRACE_DETACH, tcp, 0); #endif /* SUNOS4 */ if (!qflag) @@ -1808,7 +1805,7 @@ cleanup(void) printtrailer(); } if (tcp->flags & TCB_ATTACHED) - detach(tcp, 0); + detach(tcp); else { kill(tcp->pid, SIGCONT); kill(tcp->pid, SIGTERM); @@ -2612,7 +2609,7 @@ trace() tprints(" "); printtrailer(); } - detach(tcp, 0); + detach(tcp); } else { ptrace(PTRACE_KILL, tcp->pid, (char *) 1, SIGTERM); -- 2.40.0