2003-05-22  Roland McGrath  <roland@redhat.com>

	* defs.h (struct tcb): New member `nzombies'.
	* strace.c (alloctcb): Initialize it.
	(droptcb): Increment our parent's zombie count.
	* process.c (internal_wait): Don't go into TCB_SUSPENDED if the
	process has zombies it can reap.  On the way out, if we reaped
	an untraced process, decrement the zombie count.
diff --git a/strace.c b/strace.c
index 8f70d34..41194b7 100644
--- a/strace.c
+++ b/strace.c
@@ -621,6 +621,7 @@
 			tcp->pid = pid;
 			tcp->parent = NULL;
 			tcp->nchildren = 0;
+			tcp->nzombies = 0;
 #ifdef TCB_CLONE_THREAD
 			tcp->nclone_threads = tcp->nclone_detached = 0;
 			tcp->nclone_waiting = 0;
@@ -1011,6 +1012,10 @@
 		if (tcp->flags & TCB_CLONE_THREAD)
 			tcp->parent->nclone_threads--;
 #endif
+#ifdef TCB_CLONE_DETACHED
+		if (!(tcp->flags & TCB_CLONE_DETACHED))
+#endif
+			tcp->parent->nzombies++;
 		tcp->parent = NULL;
 	}