/* Linuxthreads - a simple clone()-based implementation of Posix *//* threads for Linux. *//* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) *//* *//* This program is free software; you can redistribute it and/or *//* modify it under the terms of the GNU Library General Public License *//* as published by the Free Software Foundation; either version 2 *//* of the License, or (at your option) any later version. *//* *//* This program is distributed in the hope that it will be useful, *//* but WITHOUT ANY WARRANTY; without even the implied warranty of *//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *//* GNU Library General Public License for more details. *//* The "thread manager" thread: manages creation and termination of threads */#include<errno.h>#include<sched.h>#include<stddef.h>#include<stdio.h>#include<stdlib.h>#include<string.h>#include<unistd.h>#include<sys/poll.h> /* for poll */#include<sys/mman.h> /* for mmap */#include<sys/param.h>#include<sys/time.h>#include<sys/wait.h> /* for waitpid macros */#include"pthread.h"#include"internals.h"#include"spinlock.h"#include"restart.h"#include"semaphore.h"/* Array of active threads. Entry 0 is reserved for the initial thread. */structpthread_handle_struct__pthread_handles[PTHREAD_THREADS_MAX]={{__LOCK_INITIALIZER,&__pthread_initial_thread