Optimize for kernels which are known to have the vfork syscall.
[glibc/pb-stable.git] / linuxthreads / internals.h
blob36fdfe1bffd98a8db66a6df1173a734ffaa56fe8
1 /* Linuxthreads - a simple clone()-based implementation of Posix */
2 /* threads for Linux. */
3 /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */
4 /* */
5 /* This program is free software; you can redistribute it and/or */
6 /* modify it under the terms of the GNU Library General Public License */
7 /* as published by the Free Software Foundation; either version 2 */
8 /* of the License, or (at your option) any later version. */
9 /* */
10 /* This program is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU Library General Public License for more details. */
15 #ifndef _INTERNALS_H
16 #define _INTERNALS_H 1
18 /* Internal data structures */
20 /* Includes */
22 #include <limits.h>
23 #include <signal.h>
24 #include <unistd.h>
25 #include <stackinfo.h>
26 #include <sigcontextinfo.h>
28 #include <tls.h>
29 #include "descr.h"
31 #include "semaphore.h"
33 #ifndef THREAD_GETMEM
34 # define THREAD_GETMEM(descr, member) descr->member
35 #endif
36 #ifndef THREAD_GETMEM_NC
37 # define THREAD_GETMEM_NC(descr, member) descr->member
38 #endif
39 #ifndef THREAD_SETMEM
40 # define THREAD_SETMEM(descr, member, value) descr->member = (value)
41 #endif
42 #ifndef THREAD_SETMEM_NC
43 # define THREAD_SETMEM_NC(descr, member, value) descr->member = (value)
44 #endif
46 #if !defined NOT_IN_libc && defined FLOATING_STACKS
47 # define LIBC_THREAD_GETMEM(descr, member) THREAD_GETMEM (descr, member)
48 # define LIBC_THREAD_SETMEM(descr, member, value) \
49 THREAD_SETMEM (descr, member, value)
50 #else
51 # define LIBC_THREAD_GETMEM(descr, member) descr->member
52 # define LIBC_THREAD_SETMEM(descr, member, value) descr->member = (value)
53 #endif
55 typedef void (*destr_function)(void *);
57 struct pthread_key_struct {
58 int in_use; /* already allocated? */
59 destr_function destr; /* destruction routine */
63 #define PTHREAD_START_ARGS_INITIALIZER(fct) \
64 { (void *(*) (void *)) fct, NULL, {{0, }}, 0, { 0 } }
67 /* The type of thread handles. */
69 typedef struct pthread_handle_struct * pthread_handle;
71 struct pthread_handle_struct {
72 struct _pthread_fastlock h_lock; /* Fast lock for sychronized access */
73 pthread_descr h_descr; /* Thread descriptor or NULL if invalid */
74 char * h_bottom; /* Lowest address in the stack thread */
77 /* The type of messages sent to the thread manager thread */
79 struct pthread_request {
80 pthread_descr req_thread; /* Thread doing the request */
81 enum { /* Request kind */
82 REQ_CREATE, REQ_FREE, REQ_PROCESS_EXIT, REQ_MAIN_THREAD_EXIT,
83 REQ_POST, REQ_DEBUG, REQ_KICK, REQ_FOR_EACH_THREAD
84 } req_kind;
85 union { /* Arguments for request */
86 struct { /* For REQ_CREATE: */
87 const pthread_attr_t * attr; /* thread attributes */
88 void * (*fn)(void *); /* start function */
89 void * arg; /* argument to start function */
90 sigset_t mask; /* signal mask */
91 } create;
92 struct { /* For REQ_FREE: */
93 pthread_t thread_id; /* identifier of thread to free */
94 } free;
95 struct { /* For REQ_PROCESS_EXIT: */
96 int code; /* exit status */
97 } exit;
98 void * post; /* For REQ_POST: the semaphore */
99 struct { /* For REQ_FOR_EACH_THREAD: callback */
100 void (*fn)(void *, pthread_descr);
101 void *arg;
102 } for_each;
103 } req_args;
108 typedef void (*arch_sighandler_t) (int, SIGCONTEXT);
109 union sighandler
111 arch_sighandler_t old;
112 void (*rt) (int, struct siginfo *, struct ucontext *);
114 extern union sighandler __sighandler[NSIG];
117 /* Signals used for suspend/restart and for cancellation notification. */
119 extern int __pthread_sig_restart;
120 extern int __pthread_sig_cancel;
122 /* Signal used for interfacing with gdb */
124 extern int __pthread_sig_debug;
126 /* Global array of thread handles, used for validating a thread id
127 and retrieving the corresponding thread descriptor. Also used for
128 mapping the available stack segments. */
130 extern struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX];
132 /* Descriptor of the main thread */
134 extern pthread_descr __pthread_main_thread;
136 /* File descriptor for sending requests to the thread manager.
137 Initially -1, meaning that __pthread_initialize_manager must be called. */
139 extern int __pthread_manager_request;
141 /* Other end of the pipe for sending requests to the thread manager. */
143 extern int __pthread_manager_reader;
145 #ifdef FLOATING_STACKS
146 /* Maximum stack size. */
147 extern size_t __pthread_max_stacksize;
148 #endif
150 /* Pending request for a process-wide exit */
152 extern int __pthread_exit_requested, __pthread_exit_code;
154 /* Set to 1 by gdb if we're debugging */
156 extern volatile int __pthread_threads_debug;
158 /* Globally enabled events. */
159 extern volatile td_thr_events_t __pthread_threads_events;
161 /* Pointer to descriptor of thread with last event. */
162 extern volatile pthread_descr __pthread_last_event;
164 /* Flag which tells whether we are executing on SMP kernel. */
165 extern int __pthread_smp_kernel;
167 /* Return the handle corresponding to a thread id */
169 static inline pthread_handle thread_handle(pthread_t id)
171 return &__pthread_handles[id % PTHREAD_THREADS_MAX];
174 /* Validate a thread handle. Must have acquired h->h_spinlock before. */
176 static inline int invalid_handle(pthread_handle h, pthread_t id)
178 return h->h_descr == NULL || h->h_descr->p_tid != id || h->h_descr->p_terminated;
181 static inline int nonexisting_handle(pthread_handle h, pthread_t id)
183 return h->h_descr == NULL || h->h_descr->p_tid != id;
186 /* Fill in defaults left unspecified by pt-machine.h. */
188 /* We round up a value with page size. */
189 #ifndef page_roundup
190 #define page_roundup(v,p) ((((size_t) (v)) + (p) - 1) & ~((p) - 1))
191 #endif
193 /* The page size we can get from the system. This should likely not be
194 changed by the machine file but, you never know. */
195 #ifndef PAGE_SIZE
196 #define PAGE_SIZE (sysconf (_SC_PAGE_SIZE))
197 #endif
199 /* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */
200 #ifndef INITIAL_STACK_SIZE
201 #define INITIAL_STACK_SIZE (4 * PAGE_SIZE)
202 #endif
204 /* Size of the thread manager stack. The "- 32" avoids wasting space
205 with some malloc() implementations. */
206 #ifndef THREAD_MANAGER_STACK_SIZE
207 #define THREAD_MANAGER_STACK_SIZE (2 * PAGE_SIZE - 32)
208 #endif
210 /* The base of the "array" of thread stacks. The array will grow down from
211 here. Defaults to the calculated bottom of the initial application
212 stack. */
213 #ifndef THREAD_STACK_START_ADDRESS
214 #define THREAD_STACK_START_ADDRESS __pthread_initial_thread_bos
215 #endif
217 /* If MEMORY_BARRIER isn't defined in pt-machine.h, assume the
218 architecture doesn't need a memory barrier instruction (e.g. Intel
219 x86). Still we need the compiler to respect the barrier and emit
220 all outstanding operations which modify memory. Some architectures
221 distinguish between full, read and write barriers. */
223 #ifndef MEMORY_BARRIER
224 #define MEMORY_BARRIER() asm ("" : : : "memory")
225 #endif
226 #ifndef READ_MEMORY_BARRIER
227 #define READ_MEMORY_BARRIER() MEMORY_BARRIER()
228 #endif
229 #ifndef WRITE_MEMORY_BARRIER
230 #define WRITE_MEMORY_BARRIER() MEMORY_BARRIER()
231 #endif
233 /* Max number of times we must spin on a spinlock calling sched_yield().
234 After MAX_SPIN_COUNT iterations, we put the calling thread to sleep. */
236 #ifndef MAX_SPIN_COUNT
237 #define MAX_SPIN_COUNT 50
238 #endif
240 /* Max number of times the spinlock in the adaptive mutex implementation
241 spins actively on SMP systems. */
243 #ifndef MAX_ADAPTIVE_SPIN_COUNT
244 #define MAX_ADAPTIVE_SPIN_COUNT 100
245 #endif
247 /* Duration of sleep (in nanoseconds) when we can't acquire a spinlock
248 after MAX_SPIN_COUNT iterations of sched_yield().
249 With the 2.0 and 2.1 kernels, this MUST BE > 2ms.
250 (Otherwise the kernel does busy-waiting for realtime threads,
251 giving other threads no chance to run.) */
253 #ifndef SPIN_SLEEP_DURATION
254 #define SPIN_SLEEP_DURATION 2000001
255 #endif
257 /* Defined and used in libc.so. */
258 extern int __libc_multiple_threads attribute_hidden;
260 /* Debugging */
262 #ifdef DEBUG
263 #include <assert.h>
264 #define ASSERT assert
265 #define MSG __pthread_message
266 #else
267 #define ASSERT(x)
268 #define MSG(msg,arg...)
269 #endif
271 /* Internal global functions */
273 extern void __pthread_do_exit (void *retval, char *currentframe)
274 __attribute__ ((__noreturn__));
275 extern void __pthread_destroy_specifics (void);
276 extern void __pthread_perform_cleanup (char *currentframe);
277 extern void __pthread_init_max_stacksize (void);
278 extern int __pthread_initialize_manager (void);
279 extern void __pthread_message (const char * fmt, ...);
280 extern int __pthread_manager (void *reqfd);
281 extern int __pthread_manager_event (void *reqfd);
282 extern void __pthread_manager_sighandler (int sig);
283 extern void __pthread_reset_main_thread (void);
284 extern void __pthread_once_fork_prepare (void);
285 extern void __pthread_once_fork_parent (void);
286 extern void __pthread_once_fork_child (void);
287 extern void __flockfilelist (void);
288 extern void __funlockfilelist (void);
289 extern void __fresetlockfiles (void);
290 extern void __pthread_manager_adjust_prio (int thread_prio);
291 extern void __pthread_initialize_minimal (void);
293 extern int __pthread_attr_setguardsize (pthread_attr_t *__attr,
294 size_t __guardsize);
295 extern int __pthread_attr_getguardsize (const pthread_attr_t *__attr,
296 size_t *__guardsize);
297 extern int __pthread_attr_setstackaddr (pthread_attr_t *__attr,
298 void *__stackaddr);
299 extern int __pthread_attr_getstackaddr (const pthread_attr_t *__attr,
300 void **__stackaddr);
301 extern int __pthread_attr_setstacksize (pthread_attr_t *__attr,
302 size_t __stacksize);
303 extern int __pthread_attr_getstacksize (const pthread_attr_t *__attr,
304 size_t *__stacksize);
305 extern int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
306 size_t __stacksize);
307 extern int __pthread_attr_getstack (const pthread_attr_t *__attr, void **__stackaddr,
308 size_t *__stacksize);
309 extern int __pthread_attr_destroy (pthread_attr_t *attr);
310 extern int __pthread_attr_setdetachstate (pthread_attr_t *attr,
311 int detachstate);
312 extern int __pthread_attr_getdetachstate (const pthread_attr_t *attr,
313 int *detachstate);
314 extern int __pthread_attr_setschedparam (pthread_attr_t *attr,
315 const struct sched_param *param);
316 extern int __pthread_attr_getschedparam (const pthread_attr_t *attr,
317 struct sched_param *param);
318 extern int __pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy);
319 extern int __pthread_attr_getschedpolicy (const pthread_attr_t *attr,
320 int *policy);
321 extern int __pthread_attr_setinheritsched (pthread_attr_t *attr, int inherit);
322 extern int __pthread_attr_getinheritsched (const pthread_attr_t *attr,
323 int *inherit);
324 extern int __pthread_attr_setscope (pthread_attr_t *attr, int scope);
325 extern int __pthread_attr_getscope (const pthread_attr_t *attr, int *scope);
327 extern int __pthread_getconcurrency (void);
328 extern int __pthread_setconcurrency (int __level);
329 extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
330 const struct timespec *__abstime);
331 extern int __pthread_mutexattr_getpshared (const pthread_mutexattr_t *__attr,
332 int *__pshared);
333 extern int __pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
334 int __pshared);
335 extern int __pthread_mutexattr_gettype (const pthread_mutexattr_t *__attr,
336 int *__kind);
337 extern void __pthread_kill_other_threads_np (void);
338 extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
339 __const pthread_mutexattr_t *__mutex_attr);
340 extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
341 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
342 extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
343 extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
344 #if defined NOT_IN_libc && defined IS_IN_libpthread
345 hidden_proto (__pthread_mutex_init)
346 hidden_proto (__pthread_mutex_destroy)
347 hidden_proto (__pthread_mutex_lock)
348 hidden_proto (__pthread_mutex_trylock)
349 hidden_proto (__pthread_mutex_unlock)
350 #endif
351 extern int __pthread_cond_init (pthread_cond_t *cond,
352 const pthread_condattr_t *cond_attr);
353 extern int __pthread_cond_destroy (pthread_cond_t *cond);
354 extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex);
355 extern int __pthread_cond_signal (pthread_cond_t *cond);
356 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
357 extern int __pthread_condattr_init (pthread_condattr_t *attr);
358 extern int __pthread_condattr_destroy (pthread_condattr_t *attr);
359 extern pthread_t __pthread_self (void);
360 extern pthread_descr __pthread_thread_self (void);
361 extern int __pthread_equal (pthread_t thread1, pthread_t thread2);
362 extern void __pthread_exit (void *retval);
363 extern int __pthread_getschedparam (pthread_t thread, int *policy,
364 struct sched_param *param);
365 extern int __pthread_setschedparam (pthread_t thread, int policy,
366 const struct sched_param *param);
367 extern int __pthread_setcancelstate (int state, int * oldstate);
368 extern int __pthread_setcanceltype (int type, int * oldtype);
370 extern void __pthread_restart_old(pthread_descr th);
371 extern void __pthread_suspend_old(pthread_descr self);
372 extern int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abs);
374 extern void __pthread_restart_new(pthread_descr th);
375 extern void __pthread_suspend_new(pthread_descr self);
376 extern int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abs);
378 extern void __pthread_wait_for_restart_signal(pthread_descr self);
380 extern int __pthread_yield (void);
382 extern int __pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
383 __const struct timespec *__restrict
384 __abstime);
385 extern int __pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
386 __const struct timespec *__restrict
387 __abstime);
388 extern int __pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr);
390 extern int __pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
391 __restrict __attr,
392 int *__restrict __pshared);
394 extern int __pthread_spin_lock (pthread_spinlock_t *__lock);
395 extern int __pthread_spin_trylock (pthread_spinlock_t *__lock);
396 extern int __pthread_spin_unlock (pthread_spinlock_t *__lock);
397 extern int __pthread_spin_init (pthread_spinlock_t *__lock, int __pshared);
398 extern int __pthread_spin_destroy (pthread_spinlock_t *__lock);
400 extern int __pthread_clock_gettime (hp_timing_t freq, struct timespec *tp);
401 extern void __pthread_clock_settime (hp_timing_t offset);
403 /* Global pointers to old or new suspend functions */
405 extern void (*__pthread_restart)(pthread_descr);
406 extern void (*__pthread_suspend)(pthread_descr);
407 extern int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *);
409 /* Prototypes for the function without cancelation support when the
410 normal version has it. */
411 extern int __libc_close (int fd);
412 extern int __libc_nanosleep (const struct timespec *requested_time,
413 struct timespec *remaining);
414 /* Prototypes for some of the new semaphore functions. */
415 extern int __new_sem_post (sem_t * sem);
416 extern int __new_sem_init (sem_t *__sem, int __pshared, unsigned int __value);
417 extern int __new_sem_wait (sem_t *__sem);
418 extern int __new_sem_trywait (sem_t *__sem);
419 extern int __new_sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval);
420 extern int __new_sem_destroy (sem_t *__sem);
422 /* Prototypes for compatibility functions. */
423 extern int __pthread_attr_init_2_1 (pthread_attr_t *__attr);
424 extern int __pthread_attr_init_2_0 (pthread_attr_t *__attr);
425 extern int __pthread_create_2_1 (pthread_t *__restrict __threadp,
426 const pthread_attr_t *__attr,
427 void *(*__start_routine) (void *),
428 void *__restrict __arg);
429 extern int __pthread_create_2_0 (pthread_t *__restrict thread,
430 const pthread_attr_t *__attr,
431 void *(*__start_routine) (void *),
432 void *__restrict arg);
434 /* The functions called the signal events. */
435 extern void __linuxthreads_create_event (void);
436 extern void __linuxthreads_death_event (void);
437 extern void __linuxthreads_reap_event (void);
439 /* This function is called to initialize the pthread library. */
440 extern void __pthread_initialize (void);
442 /* TSD. */
443 extern int __pthread_internal_tsd_set (int key, const void * pointer);
444 extern void * __pthread_internal_tsd_get (int key);
445 extern void ** __attribute__ ((__const__))
446 __pthread_internal_tsd_address (int key);
448 /* Sighandler wrappers. */
449 extern void __pthread_sighandler(int signo, SIGCONTEXT ctx);
450 extern void __pthread_sighandler_rt(int signo, struct siginfo *si,
451 struct ucontext *uc);
452 extern void __pthread_null_sighandler(int sig);
453 extern int __pthread_sigaction (int sig, const struct sigaction *act,
454 struct sigaction *oact);
455 extern int __pthread_sigwait (const sigset_t *set, int *sig);
456 extern int __pthread_raise (int sig);
458 /* Cancellation. */
459 extern int __pthread_enable_asynccancel (void) attribute_hidden;
460 extern void __pthread_disable_asynccancel (int oldtype)
461 internal_function attribute_hidden;
463 /* The two functions are in libc.so and not exported. */
464 extern int __libc_enable_asynccancel (void) attribute_hidden;
465 extern void __libc_disable_asynccancel (int oldtype)
466 internal_function attribute_hidden;
468 extern void __pthread_cleanup_upto (__jmp_buf target,
469 char *targetframe) attribute_hidden;
470 struct fork_block;
471 extern pid_t __pthread_fork (struct fork_block *b) attribute_hidden;
473 #if !defined NOT_IN_libc
474 # define LIBC_CANCEL_ASYNC() \
475 __libc_enable_asynccancel ()
476 # define LIBC_CANCEL_RESET(oldtype) \
477 __libc_disable_asynccancel (oldtype)
478 # define LIBC_CANCEL_HANDLED() \
479 __asm (".globl " __SYMBOL_PREFIX "__libc_enable_asynccancel"); \
480 __asm (".globl " __SYMBOL_PREFIX "__libc_disable_asynccancel")
481 #elif defined NOT_IN_libc && defined IS_IN_libpthread
482 # define LIBC_CANCEL_ASYNC() \
483 __pthread_enable_asynccancel ()
484 # define LIBC_CANCEL_RESET(oldtype) \
485 __pthread_disable_asynccancel (oldtype)
486 # define LIBC_CANCEL_HANDLED() \
487 __asm (".globl " __SYMBOL_PREFIX "__pthread_enable_asynccancel"); \
488 __asm (".globl " __SYMBOL_PREFIX "__pthread_disable_asynccancel")
489 #else
490 # define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
491 # define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
492 # define LIBC_CANCEL_HANDLED() /* Nothing. */
493 #endif
495 /* Data type shared with libc. The libc uses it to pass on calls to
496 the thread functions. */
497 struct pthread_functions
499 pid_t (*ptr_pthread_fork) (struct fork_block *);
500 int (*ptr_pthread_attr_destroy) (pthread_attr_t *);
501 int (*ptr___pthread_attr_init_2_0) (pthread_attr_t *);
502 int (*ptr___pthread_attr_init_2_1) (pthread_attr_t *);
503 int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *);
504 int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int);
505 int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *);
506 int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int);
507 int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *,
508 struct sched_param *);
509 int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *,
510 const struct sched_param *);
511 int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *);
512 int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int);
513 int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *);
514 int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int);
515 int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *);
516 int (*ptr_pthread_condattr_init) (pthread_condattr_t *);
517 int (*ptr___pthread_cond_broadcast) (pthread_cond_t *);
518 int (*ptr___pthread_cond_destroy) (pthread_cond_t *);
519 int (*ptr___pthread_cond_init) (pthread_cond_t *,
520 const pthread_condattr_t *);
521 int (*ptr___pthread_cond_signal) (pthread_cond_t *);
522 int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
523 int (*ptr_pthread_equal) (pthread_t, pthread_t);
524 void (*ptr___pthread_exit) (void *);
525 int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
526 int (*ptr_pthread_setschedparam) (pthread_t, int,
527 const struct sched_param *);
528 int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *);
529 int (*ptr_pthread_mutex_init) (pthread_mutex_t *,
530 const pthread_mutexattr_t *);
531 int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
532 int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *);
533 int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
534 pthread_t (*ptr_pthread_self) (void);
535 int (*ptr_pthread_setcancelstate) (int, int *);
536 int (*ptr_pthread_setcanceltype) (int, int *);
537 void (*ptr_pthread_do_exit) (void *retval, char *currentframe);
538 void (*ptr_pthread_cleanup_upto) (__jmp_buf target,
539 char *targetframe);
540 pthread_descr (*ptr_pthread_thread_self) (void);
541 int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer);
542 void * (*ptr_pthread_internal_tsd_get) (int key);
543 void ** __attribute__ ((__const__))
544 (*ptr_pthread_internal_tsd_address) (int key);
545 int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act,
546 struct sigaction *oact);
547 int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig);
548 int (*ptr_pthread_raise) (int sig);
551 /* Variable in libc.so. */
552 extern struct pthread_functions __libc_pthread_functions attribute_hidden;
553 extern int * __libc_pthread_init (const struct pthread_functions *functions);
555 #if !defined NOT_IN_libc && !defined FLOATING_STACKS
556 # ifdef SHARED
557 # define thread_self() \
558 (*__libc_pthread_functions.ptr_pthread_thread_self) ()
559 # else
560 weak_extern (__pthread_thread_self)
561 # define thread_self() __pthread_thread_self ()
562 # endif
563 #endif
565 #endif /* internals.h */