[PATCH] Remove sig parameter from detach()

Denys Vlasenko dvlasenk at redhat.com
Tue Jan 3 19:05:22 UTC 2012


* strace.c (detach): Drop sig parameter - it is zero
in all call sites.

-- 
vda


diff -d -urpN strace.0/strace.c strace.1/strace.c
--- strace.0/strace.c	2011-12-27 16:12:54.000000000 +0100
+++ strace.1/strace.c	2012-01-03 19:42:51.154290001 +0100
@@ -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);
@@ -1666,7 +1666,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
@@ -1692,7 +1692,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. */
  	}
@@ -1745,7 +1745,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,
@@ -1759,10 +1759,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)
@@ -1805,7 +1802,7 @@ cleanup(void)
  			printtrailer();
  		}
  		if (tcp->flags & TCB_ATTACHED)
-			detach(tcp, 0);
+			detach(tcp);
  		else {
  			kill(tcp->pid, SIGCONT);
  			kill(tcp->pid, SIGTERM);




More information about the Strace-devel mailing list