weaks.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* The weak pthread functions for Linux.
  2. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. 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. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with the GNU C Library; see the file COPYING.LIB. If not,
  14. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA. */
  16. #define _GNU_SOURCE
  17. #include <errno.h>
  18. #include <limits.h>
  19. #include <stdlib.h>
  20. static int __pthread_return_0 __P ((void));
  21. static int __pthread_return_1 __P ((void));
  22. static int
  23. __pthread_return_0 (void)
  24. {
  25. return 0;
  26. }
  27. static int
  28. __pthread_return_1 (void)
  29. {
  30. return 1;
  31. }
  32. /**********************************************************************/
  33. /* Weaks for application/library use.
  34. *
  35. * Verified by comparing to glibc's linuxthreads/forward.c and defined
  36. * only those that are in the glibc abi.
  37. * The commented aliases are ones that were previously defined in uClibc
  38. * and which I left in for documentation.
  39. */
  40. weak_alias (__pthread_return_0, pthread_attr_destroy)
  41. weak_alias (__pthread_return_0, pthread_attr_getdetachstate)
  42. weak_alias (__pthread_return_0, pthread_attr_getinheritsched)
  43. weak_alias (__pthread_return_0, pthread_attr_getschedparam)
  44. weak_alias (__pthread_return_0, pthread_attr_getschedpolicy)
  45. weak_alias (__pthread_return_0, pthread_attr_getscope)
  46. /* weak_alias (__pthread_return_0, pthread_attr_getstackaddr) */
  47. /* weak_alias (__pthread_return_0, pthread_attr_getstacksize) */
  48. weak_alias (__pthread_return_0, pthread_attr_init)
  49. weak_alias (__pthread_return_0, pthread_attr_setdetachstate)
  50. weak_alias (__pthread_return_0, pthread_attr_setinheritsched)
  51. weak_alias (__pthread_return_0, pthread_attr_setschedparam)
  52. weak_alias (__pthread_return_0, pthread_attr_setschedpolicy)
  53. weak_alias (__pthread_return_0, pthread_attr_setscope)
  54. /* weak_alias (__pthread_return_0, pthread_attr_setstackaddr) */
  55. /* weak_alias (__pthread_return_0, pthread_attr_setstacksize) */
  56. weak_alias (__pthread_return_0, pthread_cond_broadcast)
  57. weak_alias (__pthread_return_0, pthread_cond_destroy)
  58. weak_alias (__pthread_return_0, pthread_cond_init)
  59. weak_alias (__pthread_return_0, pthread_cond_signal)
  60. weak_alias (__pthread_return_0, pthread_cond_timedwait)
  61. weak_alias (__pthread_return_0, pthread_cond_wait)
  62. weak_alias (__pthread_return_0, pthread_condattr_destroy)
  63. weak_alias (__pthread_return_0, pthread_condattr_init)
  64. weak_alias (__pthread_return_0, pthread_getschedparam)
  65. /* weak_alias (__pthread_return_0, pthread_getcancelstate) */
  66. /* weak_alias (__pthread_return_0, pthread_getconcurrency) */
  67. /* weak_alias (__pthread_return_0, pthread_getschedparam) */
  68. weak_alias (__pthread_return_0, pthread_mutex_destroy)
  69. weak_alias (__pthread_return_0, pthread_mutex_init)
  70. weak_alias (__pthread_return_0, pthread_mutex_lock)
  71. /* weak_alias (__pthread_return_0, pthread_mutex_trylock) */
  72. weak_alias (__pthread_return_0, pthread_mutex_unlock)
  73. /* weak_alias (__pthread_return_0, pthread_mutexattr_destroy) */
  74. /* weak_alias (__pthread_return_0, pthread_mutexattr_gettype) */
  75. /* weak_alias (__pthread_return_0, pthread_mutexattr_init) */
  76. /* weak_alias (__pthread_return_0, pthread_mutexattr_settype) */
  77. /* weak_alias (__pthread_return_0, pthread_rwlock_destroy) */
  78. /* weak_alias (__pthread_return_0, pthread_rwlock_init) */
  79. /* weak_alias (__pthread_return_0, pthread_rwlock_rdlock) */
  80. /* weak_alias (__pthread_return_0, pthread_rwlock_tryrdlock) */
  81. /* weak_alias (__pthread_return_0, pthread_rwlock_trywrlock) */
  82. /* weak_alias (__pthread_return_0, pthread_rwlock_unlock) */
  83. /* weak_alias (__pthread_return_0, pthread_rwlock_wrlock) */
  84. /* weak_alias (__pthread_return_0, pthread_rwlockattr_destroy) */
  85. /* weak_alias (__pthread_return_0, pthread_rwlockattr_getpshared) */
  86. /* weak_alias (__pthread_return_0, pthread_rwlockattr_init) */
  87. /* weak_alias (__pthread_return_0, pthread_rwlockattr_setpshared) */
  88. weak_alias (__pthread_return_0, pthread_self)
  89. weak_alias (__pthread_return_0, pthread_setcancelstate)
  90. weak_alias (__pthread_return_0, pthread_setcanceltype)
  91. /* weak_alias (__pthread_return_0, pthread_setconcurrency) */
  92. weak_alias (__pthread_return_0, pthread_setschedparam)
  93. /* Those are pthread functions which return 1 if successful. */
  94. weak_alias (__pthread_return_1, pthread_equal)
  95. /* pthread_exit () is a special case. */
  96. void weak_function
  97. pthread_exit (void *retval)
  98. {
  99. exit (EXIT_SUCCESS);
  100. }
  101. /**********************************************************************/
  102. /* Weaks used internally by the C library. */
  103. weak_alias (__pthread_return_0, __pthread_mutex_init)
  104. weak_alias (__pthread_return_0, __pthread_mutex_lock)
  105. weak_alias (__pthread_return_0, __pthread_mutex_trylock)
  106. weak_alias (__pthread_return_0, __pthread_mutex_unlock)
  107. /**********************************************************************/