123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- #ifndef _DESCR_H
- #define _DESCR_H 1
- #define __need_res_state
- #include <resolv.h>
- #include <sched.h>
- #include <setjmp.h>
- #include <signal.h>
- #include <stdint.h>
- #include <sys/types.h>
- #include <hp-timing.h>
- #ifdef USE_TLS
- #include <tls.h>
- #endif
- #include "uClibc-glue.h"
- enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
- _LIBC_TSD_KEY_DL_ERROR,
- _LIBC_TSD_KEY_RPC_VARS,
- _LIBC_TSD_KEY_LOCALE,
- _LIBC_TSD_KEY_CTYPE_B,
- _LIBC_TSD_KEY_CTYPE_TOLOWER,
- _LIBC_TSD_KEY_CTYPE_TOUPPER,
- _LIBC_TSD_KEY_N };
- typedef struct _pthread_descr_struct *pthread_descr;
- #include <pt-machine.h>
- #include <linuxthreads_db/thread_dbP.h>
- struct pthread_start_args {
- void *(*start_routine)(void *);
- void *arg;
- sigset_t mask;
- int schedpolicy;
- struct sched_param schedparam;
- };
- typedef struct _pthread_extricate_struct {
- void *pu_object;
- int (*pu_extricate_func)(void *, pthread_descr);
- } pthread_extricate_if;
- struct pthread_atomic {
- long p_count;
- int p_spinlock;
- };
- struct _pthread_rwlock_t;
- typedef struct _pthread_rwlock_info {
- struct _pthread_rwlock_info *pr_next;
- struct _pthread_rwlock_t *pr_lock;
- int pr_lock_count;
- } pthread_readlock_info;
- #define PTHREAD_KEY_2NDLEVEL_SIZE 32
- #define PTHREAD_KEY_1STLEVEL_SIZE \
- ((PTHREAD_KEYS_MAX + PTHREAD_KEY_2NDLEVEL_SIZE - 1) \
- / PTHREAD_KEY_2NDLEVEL_SIZE)
- union dtv;
- struct _pthread_descr_struct
- {
- #if !defined USE_TLS || !TLS_DTV_AT_TP || INCLUDE_TLS_PADDING
-
- union
- {
- struct
- {
- void *tcb;
- union dtv *dtvp;
- pthread_descr self;
- int multiple_threads;
- uintptr_t sysinfo;
- } data;
- void *__padding[16];
- } p_header;
- # define p_multiple_threads p_header.data.multiple_threads
- #elif defined TLS_MULTIPLE_THREADS_IN_TCB && TLS_MULTIPLE_THREADS_IN_TCB
- int p_multiple_threads;
- #endif
- pthread_descr p_nextlive, p_prevlive;
-
- pthread_descr p_nextwaiting;
- pthread_descr p_nextlock;
- pthread_t p_tid;
- int p_pid;
- int p_priority;
- struct _pthread_fastlock * p_lock;
- int p_signal;
- sigjmp_buf * p_signal_jmp;
- sigjmp_buf * p_cancel_jmp;
- char p_terminated;
- char p_detached;
- char p_exited;
- void * p_retval;
- int p_retcode;
- pthread_descr p_joining;
- struct _pthread_cleanup_buffer * p_cleanup;
- char p_cancelstate;
- char p_canceltype;
- char p_canceled;
- char * p_in_sighandler;
- char p_sigwaiting;
- struct pthread_start_args p_start_args;
- void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE];
- #if !(USE_TLS && HAVE___THREAD)
- void * p_libc_specific[_LIBC_TSD_KEY_N];
- int * p_errnop;
- int p_errno;
- int * p_h_errnop;
- int p_h_errno;
- struct __res_state *p_resp;
- #endif
- struct __res_state p_res;
- int p_userstack;
- void *p_guardaddr;
- size_t p_guardsize;
- int p_nr;
- int p_report_events;
- td_eventbuf_t p_eventbuf;
- struct pthread_atomic p_resume_count;
- char p_woken_by_cancel;
- char p_condvar_avail;
- char p_sem_avail;
- pthread_extricate_if *p_extricate;
- pthread_readlock_info *p_readlock_list;
- pthread_readlock_info *p_readlock_free;
- int p_untracked_readlock_count;
- int p_inheritsched;
- #if HP_TIMING_AVAIL
- hp_timing_t p_cpuclock_offset;
- #endif
- #ifdef USE_TLS
- char *p_stackaddr;
- #endif
- size_t p_alloca_cutoff;
-
- } __attribute__ ((aligned(32)));
- extern char *__pthread_initial_thread_bos;
- extern struct _pthread_descr_struct __pthread_initial_thread;
- extern char *__pthread_manager_thread_bos;
- extern char *__pthread_manager_thread_tos;
- extern struct _pthread_descr_struct __pthread_manager_thread;
- extern pthread_descr __pthread_manager_threadp attribute_hidden;
- extern int __pthread_nonstandard_stacks;
- #ifndef STACK_SIZE
- #define STACK_SIZE (2 * 1024 * 1024)
- #endif
- #ifndef CURRENT_STACK_FRAME
- #define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
- #endif
- extern pthread_descr __pthread_find_self (void) __attribute__ ((pure));
- static __inline__ pthread_descr thread_self (void) __attribute__ ((pure));
- static __inline__ pthread_descr thread_self (void)
- {
- #ifdef THREAD_SELF
- return THREAD_SELF;
- #else
- char *sp = CURRENT_STACK_FRAME;
- if (sp >= __pthread_initial_thread_bos)
- return &__pthread_initial_thread;
- else if (sp >= __pthread_manager_thread_bos
- && sp < __pthread_manager_thread_tos)
- return &__pthread_manager_thread;
- else if (__pthread_nonstandard_stacks)
- return __pthread_find_self();
- else
- #ifdef _STACK_GROWS_DOWN
- return (pthread_descr)(((unsigned long)sp | (STACK_SIZE-1))+1) - 1;
- #else
- return (pthread_descr)((unsigned long)sp &~ (STACK_SIZE-1));
- #endif
- #endif
- }
- #endif
|