2003-01-08  Roland McGrath  <roland@redhat.com>

	Support for new Linux 2.5 thread features.
	* defs.h [LINUX]: Define __NR_exit_group if not defined.
	(struct tcb): New members nclone_threads, nclone_detached,
	and nclone_waiting.
	(TCB_CLONE_DETACHED, TCB_CLONE_THREAD, TCB_GROUP_EXITING): New macros.
	(waiting_parent): Macro removed.
	(pid2tcb): Declare it.
	* process.c (internal_clone) [TCB_CLONE_THREAD]: Reparent the new
	child to our parent if we are a CLONE_THREAD child ourselves.
	Maintain TCB_CLONE_THREAD and TCB_CLONE_DETACHED flags and counts.
	(internal_wait) [TCB_CLONE_THREAD]: Factor out detached children when
	determining if we have any.  If TCB_CLONE_THREAD is set, check
	parent's children instead of our own, and bump nclone_waiting count.
	(internal_exit) [__NR_exit_group]: Set the TCB_GROUP_EXITING flag if
	the syscall was exit_group.
	* syscall.c (internal_syscall): Use internal_exit for exit_group.
	* strace.c (pid2tcb): No longer static.
	(alloctcb) [TCB_CLONE_THREAD]: Initialize new fields.
	(droptcb) [TCB_CLONE_THREAD]: Maintain new fields.
	If we have thread children, set TCB_EXITING and don't clear the TCB.
	(resume) [TCB_CLONE_THREAD]: Decrement parent's nclone_waiting.
	(detach) [TCB_CLONE_THREAD]: When calling resume, check all thread
	children of our parent that might be waiting for us too.
	[TCB_GROUP_EXITING] (handle_group_exit): New function.
	(trace) [TCB_GROUP_EXITING]: Use that in place of detach or droptcb.
diff --git a/syscall.c b/syscall.c
index 204b8ac..578db44 100644
--- a/syscall.c
+++ b/syscall.c
@@ -670,6 +670,9 @@
 #ifdef SYS32_exit
 	case SYS32_exit:
 #endif
+#ifdef __NR_exit_group
+	case __NR_exit_group:
+#endif
 		internal_exit(tcp);
 		break;
 	}