Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #ifndef _PTHREAD_IMPL_H |
| 2 | #define _PTHREAD_IMPL_H |
| 3 | |
| 4 | #include <pthread.h> |
| 5 | #include <sched.h> |
| 6 | #include <signal.h> |
| 7 | #include <unistd.h> |
| 8 | #include <sys/mman.h> |
| 9 | #include <errno.h> |
| 10 | #include <limits.h> |
| 11 | #include <inttypes.h> |
| 12 | #include <setjmp.h> |
| 13 | #include <string.h> |
| 14 | #include <time.h> |
| 15 | #include "libc.h" |
| 16 | #include "syscall.h" |
| 17 | #include "atomic.h" |
| 18 | #include "futex.h" |
| 19 | |
| 20 | #define pthread __pthread |
| 21 | |
| 22 | struct pthread { |
Rich Felker | 0b2006c | 2011-02-15 03:24:58 -0500 | [diff] [blame] | 23 | struct pthread *self; |
| 24 | unsigned long tlsdesc[4]; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 25 | pid_t tid, pid; |
Rich Felker | 0b2006c | 2011-02-15 03:24:58 -0500 | [diff] [blame] | 26 | int tsd_used, errno_val, *errno_ptr; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 27 | volatile int canceldisable, cancelasync, cancelpoint, cancel; |
| 28 | unsigned char *map_base; |
| 29 | size_t map_size; |
| 30 | void *start_arg; |
| 31 | void *(*start)(void *); |
| 32 | void *result; |
| 33 | jmp_buf exit_jmp_buf; |
| 34 | int detached; |
| 35 | int exitlock; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 36 | struct __ptcb *cancelbuf; |
| 37 | void **tsd; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 38 | pthread_attr_t attr; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 39 | }; |
| 40 | |
Rich Felker | 7b2dd22 | 2011-02-15 03:56:52 -0500 | [diff] [blame^] | 41 | #include "pthread_arch.h" |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 42 | |
| 43 | #define SIGCANCEL 32 |
| 44 | #define SIGSYSCALL 33 |
| 45 | #define SIGTIMER 32 /* ?? */ |
| 46 | |
Rich Felker | 7b2dd22 | 2011-02-15 03:56:52 -0500 | [diff] [blame^] | 47 | int __set_thread_area(void *); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 48 | int __libc_sigaction(int, const struct sigaction *, struct sigaction *); |
| 49 | int __libc_sigprocmask(int, const sigset_t *, sigset_t *); |
| 50 | void __lock(volatile int *); |
| 51 | void __unmapself(void *, size_t); |
| 52 | |
| 53 | int __timedwait(volatile int *, int, clockid_t, const struct timespec *, int); |
| 54 | void __wait(volatile int *, volatile int *, int, int); |
| 55 | void __wake(volatile int *, int, int); |
| 56 | |
| 57 | #define DEFAULT_STACK_SIZE (16384-PAGE_SIZE) |
| 58 | #define DEFAULT_GUARD_SIZE PAGE_SIZE |
| 59 | |
| 60 | #endif |