1 /* Copyright (C) 2002-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
24 #include <shlib-compat.h>
26 #include <safe-fatal.h>
29 /* Pointers to the libc functions. */
30 struct pthread_functions __libc_pthread_functions attribute_hidden
;
31 int __libc_pthread_functions_init attribute_hidden
;
34 #define FORWARD2(name, rettype, decl, params, defaction) \
38 if (!__libc_pthread_functions_init) \
41 return PTHFCT_CALL (ptr_##name, params); \
44 /* Same as FORWARD2, only without return. */
45 #define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
49 if (!__libc_pthread_functions_init) \
52 PTHFCT_CALL (ptr_##name, params); \
55 #define FORWARD(name, decl, params, defretval) \
56 FORWARD2 (name, int, decl, params, return defretval)
59 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
60 FORWARD2 (__pthread_cond_broadcast_2_0
, int attribute_compat_text_section
,
61 (pthread_cond_2_0_t
*cond
), (cond
), return 0)
62 compat_symbol (libc
, __pthread_cond_broadcast_2_0
, pthread_cond_broadcast
,
65 FORWARD (__pthread_cond_broadcast
, (pthread_cond_t
*cond
), (cond
), 0)
66 versioned_symbol (libc
, __pthread_cond_broadcast
, pthread_cond_broadcast
,
69 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
70 FORWARD2 (__pthread_cond_signal_2_0
, int attribute_compat_text_section
,
71 (pthread_cond_2_0_t
*cond
), (cond
), return 0)
72 compat_symbol (libc
, __pthread_cond_signal_2_0
, pthread_cond_signal
,
75 FORWARD (__pthread_cond_signal
, (pthread_cond_t
*cond
), (cond
), 0)
76 versioned_symbol (libc
, __pthread_cond_signal
, pthread_cond_signal
,
79 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
80 FORWARD2 (__pthread_cond_wait_2_0
, int attribute_compat_text_section
,
81 (pthread_cond_2_0_t
*cond
, pthread_mutex_t
*mutex
), (cond
, mutex
),
83 compat_symbol (libc
, __pthread_cond_wait_2_0
, pthread_cond_wait
,
86 FORWARD (__pthread_cond_wait
, (pthread_cond_t
*cond
, pthread_mutex_t
*mutex
),
88 versioned_symbol (libc
, __pthread_cond_wait
, pthread_cond_wait
,
91 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
92 FORWARD2 (__pthread_cond_timedwait_2_0
, int attribute_compat_text_section
,
93 (pthread_cond_2_0_t
*cond
, pthread_mutex_t
*mutex
,
94 const struct timespec
*abstime
), (cond
, mutex
, abstime
),
96 compat_symbol (libc
, __pthread_cond_timedwait_2_0
, pthread_cond_timedwait
,
99 FORWARD (__pthread_cond_timedwait
,
100 (pthread_cond_t
*cond
, pthread_mutex_t
*mutex
,
101 const struct timespec
*abstime
), (cond
, mutex
, abstime
), 0)
102 versioned_symbol (libc
, __pthread_cond_timedwait
, pthread_cond_timedwait
,
106 FORWARD_NORETURN (__pthread_exit
, void, (void *retval
), (retval
),
108 strong_alias (__pthread_exit
, pthread_exit
);
111 FORWARD (pthread_mutex_destroy
, (pthread_mutex_t
*mutex
), (mutex
), 0)
113 FORWARD (pthread_mutex_init
,
114 (pthread_mutex_t
*mutex
, const pthread_mutexattr_t
*mutexattr
),
115 (mutex
, mutexattr
), 0)
117 FORWARD (pthread_mutex_lock
, (pthread_mutex_t
*mutex
), (mutex
), 0)
119 FORWARD (pthread_mutex_unlock
, (pthread_mutex_t
*mutex
), (mutex
), 0)
121 FORWARD (__pthread_setcancelstate
, (int state
, int *oldstate
),
122 (state
, oldstate
), 0)
123 strong_alias (__pthread_setcancelstate
, pthread_setcancelstate
)
125 FORWARD (pthread_setcanceltype
, (int type
, int *oldtype
), (type
, oldtype
), 0)
127 FORWARD_NORETURN (__pthread_unwind
,
128 void attribute_hidden
__attribute ((noreturn
))
129 __cleanup_fct_attribute attribute_compat_text_section
,
130 (__pthread_unwind_buf_t
*buf
), (buf
),