Remove TCB_SUSPENDED constant and related code.

Since we no longer suspend waitpid'ing tracees, we have only one case when
we suspend tracee: when we pick up a new tracee created by clone/fork/vfork.

Background: on some other OSes, attach to child is done this way:
get fork's result (pid), loop ptrace(PTRACE_ATTACH) until you hook up
new process/thread. This is ugly and not safe, but what matters for us
is that it doesn't require suspending. Suspending is required
on Linux only, because on Linux attach to child is done differently.

On Linux, we use two methods of catching new tracee:
adding CLONE_THREAD bit to syscall (if needed, we change
[v]fork into clone before that), or using ptrace options.
In both cases, it may be so that new tracee appears before one which
created it returns from syscall. In this case, current code
suspends new tracee until its creator returns. Only then
strace can determine who is its parent (it needs child's pid for this,
which is visible in parent's [v]fork/clone result).
This is inherently racy. For example, what if SIGKILL kills
creator after it succeeded creating child, but before it returns?
Looks like we will have child suspended forever.

But after previous commit, we DO NOT NEED parent<->child link for anything.
Therefore we do not need suspending too. Bingo!

This patch removes suspending code. Now new tracees will be continued
right away. Next patch will remove tcp->parent member.

* defs.h: Remove TCB_SUSPENDED constant
* process.c (handle_new_child): Delete this function.
  (internal_fork): Do not call handle_new_child on syscall exit.
* strace.c (handle_ptrace_event): Delete this function.
  (trace): Do not suspend new child; remove all handling
  of now impossible TCB_SUSPENDED condition.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/strace.c b/strace.c
index 1106255..b2ebb54 100644
--- a/strace.c
+++ b/strace.c
@@ -2216,32 +2216,6 @@
 
 #else /* !USE_PROCFS */
 
-#ifdef LINUX
-static int
-handle_ptrace_event(int status, struct tcb *tcp)
-{
-	if (status >> 16 == PTRACE_EVENT_VFORK ||
-	    status >> 16 == PTRACE_EVENT_CLONE ||
-	    status >> 16 == PTRACE_EVENT_FORK) {
-		long childpid;
-
-		if (do_ptrace(PTRACE_GETEVENTMSG, tcp, NULL, &childpid) < 0) {
-			if (errno != ESRCH) {
-				error_msg_and_die("Cannot get new child's pid");
-			}
-			return -1;
-		}
-		return handle_new_child(tcp, childpid, 0);
-	}
-	if (status >> 16 == PTRACE_EVENT_EXEC) {
-		return 0;
-	}
-	/* Some PTRACE_EVENT_foo we didn't ask for?! */
-	error_msg("Unexpected status %x on pid %d", status, tcp->pid);
-	return 1;
-}
-#endif
-
 static int
 trace()
 {
@@ -2369,10 +2343,9 @@
 				   child so that we know how to do clearbpt
 				   in the child.  */
 				tcp = alloctcb(pid);
-				tcp->flags |= TCB_ATTACHED | TCB_SUSPENDED;
+				tcp->flags |= TCB_ATTACHED;
 				if (!qflag)
-					fprintf(stderr, "\
-Process %d attached (waiting for parent)\n",
+					fprintf(stderr, "Process %d attached\n",
 						pid);
 			}
 			else
@@ -2395,17 +2368,6 @@
 		}
 #endif
 
-		if (tcp->flags & TCB_SUSPENDED) {
-			/*
-			 * Apparently, doing any ptrace() call on a stopped
-			 * process, provokes the kernel to report the process
-			 * status again on a subsequent wait(), even if the
-			 * process has not been actually restarted.
-			 * Since we have inspected the arguments of suspended
-			 * processes we end up here testing for this case.
-			 */
-			continue;
-		}
 		if (WIFSIGNALED(status)) {
 			if (pid == strace_child)
 				exit_code = 0x100 | WTERMSIG(status);
@@ -2449,8 +2411,8 @@
 		}
 
 		if (status >> 16) {
-			if (handle_ptrace_event(status, tcp) != 1)
-				goto tracing;
+			/* Ptrace event (we ignore all of them for now) */
+			goto tracing;
 		}
 
 		/*
@@ -2548,7 +2510,6 @@
 				cleanup();
 				return -1;
 			}
-			tcp->flags &= ~TCB_SUSPENDED;
 			continue;
 		}
 		/* we handled the STATUS, we are permitted to interrupt now. */
@@ -2579,11 +2540,6 @@
 			}
 			continue;
 		}
-		if (tcp->flags & TCB_SUSPENDED) {
-			if (!qflag)
-				fprintf(stderr, "Process %u suspended\n", pid);
-			continue;
-		}
 	tracing:
 		/* Remember current print column before continuing. */
 		tcp->curcol = curcol;