pthread-functions.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifndef _PTHREAD_FUNCTIONS_H
  17. #define _PTHREAD_FUNCTIONS_H 1
  18. #include <pthread.h>
  19. #include <setjmp.h>
  20. #include <internaltypes.h>
  21. #include <sysdep.h>
  22. struct xid_command;
  23. /* Data type shared with libc. The libc uses it to pass on calls to
  24. the thread functions. */
  25. struct pthread_functions
  26. {
  27. int (*ptr_pthread_attr_destroy) (pthread_attr_t *);
  28. int (*ptr___pthread_attr_init_2_0) (pthread_attr_t *);
  29. int (*ptr___pthread_attr_init_2_1) (pthread_attr_t *);
  30. int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *);
  31. int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int);
  32. int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *);
  33. int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int);
  34. int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *,
  35. struct sched_param *);
  36. int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *,
  37. const struct sched_param *);
  38. int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *);
  39. int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int);
  40. int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *);
  41. int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int);
  42. int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *);
  43. int (*ptr_pthread_condattr_init) (pthread_condattr_t *);
  44. int (*ptr___pthread_cond_broadcast) (pthread_cond_t *);
  45. int (*ptr___pthread_cond_destroy) (pthread_cond_t *);
  46. int (*ptr___pthread_cond_init) (pthread_cond_t *,
  47. const pthread_condattr_t *);
  48. int (*ptr___pthread_cond_signal) (pthread_cond_t *);
  49. int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
  50. int (*ptr___pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
  51. const struct timespec *);
  52. int (*ptr___pthread_cond_broadcast_2_0) (pthread_cond_2_0_t *);
  53. int (*ptr___pthread_cond_destroy_2_0) (pthread_cond_2_0_t *);
  54. int (*ptr___pthread_cond_init_2_0) (pthread_cond_2_0_t *,
  55. const pthread_condattr_t *);
  56. int (*ptr___pthread_cond_signal_2_0) (pthread_cond_2_0_t *);
  57. int (*ptr___pthread_cond_wait_2_0) (pthread_cond_2_0_t *, pthread_mutex_t *);
  58. int (*ptr___pthread_cond_timedwait_2_0) (pthread_cond_2_0_t *,
  59. pthread_mutex_t *,
  60. const struct timespec *);
  61. int (*ptr_pthread_equal) (pthread_t, pthread_t);
  62. void (*ptr___pthread_exit) (void *);
  63. int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
  64. int (*ptr_pthread_setschedparam) (pthread_t, int,
  65. const struct sched_param *);
  66. int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *);
  67. int (*ptr_pthread_mutex_init) (pthread_mutex_t *,
  68. const pthread_mutexattr_t *);
  69. int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
  70. int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
  71. pthread_t (*ptr_pthread_self) (void);
  72. int (*ptr_pthread_setcancelstate) (int, int *);
  73. int (*ptr_pthread_setcanceltype) (int, int *);
  74. void (*ptr___pthread_cleanup_upto) (__jmp_buf, char *);
  75. int (*ptr___pthread_once) (pthread_once_t *, void (*) (void));
  76. int (*ptr___pthread_rwlock_rdlock) (pthread_rwlock_t *);
  77. int (*ptr___pthread_rwlock_wrlock) (pthread_rwlock_t *);
  78. int (*ptr___pthread_rwlock_unlock) (pthread_rwlock_t *);
  79. int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *));
  80. void *(*ptr___pthread_getspecific) (pthread_key_t);
  81. int (*ptr___pthread_setspecific) (pthread_key_t, const void *);
  82. void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer *,
  83. void (*) (void *), void *);
  84. void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer *,
  85. int);
  86. #define HAVE_PTR_NTHREADS
  87. unsigned int *ptr_nthreads;
  88. void (*ptr___pthread_unwind) (__pthread_unwind_buf_t *)
  89. __attribute ((noreturn)) __cleanup_fct_attribute;
  90. void (*ptr__nptl_deallocate_tsd) (void);
  91. int (*ptr__nptl_setxid) (struct xid_command *);
  92. void (*ptr_freeres) (void);
  93. };
  94. /* Variable in libc.so. */
  95. extern struct pthread_functions __libc_pthread_functions attribute_hidden;
  96. extern int __libc_pthread_functions_init attribute_hidden;
  97. #if 0 /* def PTR_DEMANGLE */ /* we did not mangle, so do not demangle */
  98. # define PTHFCT_CALL(fct, params) \
  99. ({ __typeof (__libc_pthread_functions.fct) __p; \
  100. __p = __libc_pthread_functions.fct; \
  101. PTR_DEMANGLE (__p); \
  102. __p params; })
  103. #else
  104. # define PTHFCT_CALL(fct, params) \
  105. __libc_pthread_functions.fct params
  106. #endif
  107. #endif /* pthread-functions.h */