1 /* Copyright (C) 2002, 2003 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include <shlib-compat.h>
28 /* Pointers to the libc functions. */
29 struct pthread_functions __libc_pthread_functions attribute_hidden
;
32 #define FORWARD2(name, rettype, decl, params, defaction) \
36 if (__libc_pthread_functions.ptr_##name == NULL) \
39 return __libc_pthread_functions.ptr_##name params; \
42 #define FORWARD(name, decl, params, defretval) \
43 FORWARD2 (name, int, decl, params, return defretval)
46 FORWARD (pthread_attr_destroy
, (pthread_attr_t
*attr
), (attr
), 0)
48 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
49 FORWARD (__pthread_attr_init_2_0
, (pthread_attr_t
*attr
), (attr
), 0)
50 compat_symbol (libc
, pthread_attr_init_2_0
, pthread_attr_init
, GLIBC_2_0
);
53 FORWARD (__pthread_attr_init_2_1
, (pthread_attr_t
*attr
), (attr
), 0)
54 versioned_symbol (libc
, __pthread_attr_init_2_1
, pthread_attr_init
, GLIBC_2_1
);
56 FORWARD (pthread_attr_getdetachstate
,
57 (const pthread_attr_t
*attr
, int *detachstate
), (attr
, detachstate
),
59 FORWARD (pthread_attr_setdetachstate
, (pthread_attr_t
*attr
, int detachstate
),
60 (attr
, detachstate
), 0)
62 FORWARD (pthread_attr_getinheritsched
,
63 (const pthread_attr_t
*attr
, int *inherit
), (attr
, inherit
), 0)
64 FORWARD (pthread_attr_setinheritsched
, (pthread_attr_t
*attr
, int inherit
),
67 FORWARD (pthread_attr_getschedparam
,
68 (const pthread_attr_t
*attr
, struct sched_param
*param
),
70 FORWARD (pthread_attr_setschedparam
,
71 (pthread_attr_t
*attr
, const struct sched_param
*param
),
74 FORWARD (pthread_attr_getschedpolicy
,
75 (const pthread_attr_t
*attr
, int *policy
), (attr
, policy
), 0)
76 FORWARD (pthread_attr_setschedpolicy
, (pthread_attr_t
*attr
, int policy
),
79 FORWARD (pthread_attr_getscope
,
80 (const pthread_attr_t
*attr
, int *scope
), (attr
, scope
), 0)
81 FORWARD (pthread_attr_setscope
, (pthread_attr_t
*attr
, int scope
),
85 FORWARD (pthread_condattr_destroy
, (pthread_condattr_t
*attr
), (attr
), 0)
86 FORWARD (pthread_condattr_init
, (pthread_condattr_t
*attr
), (attr
), 0)
88 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
89 FORWARD (__pthread_cond_broadcast_2_0
, (pthread_cond_2_0_t
*cond
), (cond
), 0)
90 compat_symbol (libc
, __pthread_cond_broadcast_2_0
, pthread_cond_broadcast
,
93 FORWARD (__pthread_cond_broadcast
, (pthread_cond_t
*cond
), (cond
), 0)
94 versioned_symbol (libc
, __pthread_cond_broadcast
, pthread_cond_broadcast
,
97 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
98 FORWARD (__pthread_cond_destroy_2_0
, (pthread_cond_2_0_t
*cond
), (cond
), 0)
99 compat_symbol (libc
, __pthread_cond_destroy_2_0
, pthread_cond_destroy
,
102 FORWARD (__pthread_cond_destroy
, (pthread_cond_t
*cond
), (cond
), 0)
103 versioned_symbol (libc
, __pthread_cond_destroy
, pthread_cond_destroy
,
106 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
107 FORWARD (__pthread_cond_init_2_0
,
108 (pthread_cond_2_0_t
*cond
, const pthread_condattr_t
*cond_attr
),
109 (cond
, cond_attr
), 0)
110 compat_symbol (libc
, __pthread_cond_init_2_0
, pthread_cond_init
, GLIBC_2_0
);
112 FORWARD (__pthread_cond_init
,
113 (pthread_cond_t
*cond
, const pthread_condattr_t
*cond_attr
),
114 (cond
, cond_attr
), 0)
115 versioned_symbol (libc
, __pthread_cond_init
, pthread_cond_init
, GLIBC_2_3_2
);
117 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
118 FORWARD (__pthread_cond_signal_2_0
, (pthread_cond_2_0_t
*cond
), (cond
), 0)
119 compat_symbol (libc
, __pthread_cond_signal_2_0
, pthread_cond_signal
,
122 FORWARD (__pthread_cond_signal
, (pthread_cond_t
*cond
), (cond
), 0)
123 versioned_symbol (libc
, __pthread_cond_signal
, pthread_cond_signal
,
126 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
127 FORWARD (__pthread_cond_wait_2_0
,
128 (pthread_cond_2_0_t
*cond
, pthread_mutex_t
*mutex
), (cond
, mutex
), 0)
129 compat_symbol (libc
, __pthread_cond_wait_2_0
, pthread_cond_wait
,
132 FORWARD (__pthread_cond_wait
, (pthread_cond_t
*cond
, pthread_mutex_t
*mutex
),
134 versioned_symbol (libc
, __pthread_cond_wait
, pthread_cond_wait
,
138 FORWARD (pthread_equal
, (pthread_t thread1
, pthread_t thread2
),
139 (thread1
, thread2
), 1)
142 /* Use an alias to avoid warning, as pthread_exit is declared noreturn. */
143 FORWARD2 (__pthread_exit
, void, (void *retval
), (retval
), exit (EXIT_SUCCESS
))
144 strong_alias (__pthread_exit
, pthread_exit
);
147 FORWARD (pthread_getschedparam
,
148 (pthread_t target_thread
, int *policy
, struct sched_param
*param
),
149 (target_thread
, policy
, param
), 0)
150 FORWARD (pthread_setschedparam
,
151 (pthread_t target_thread
, int policy
,
152 const struct sched_param
*param
), (target_thread
, policy
, param
), 0)
155 FORWARD (pthread_mutex_destroy
, (pthread_mutex_t
*mutex
), (mutex
), 0)
157 FORWARD (pthread_mutex_init
,
158 (pthread_mutex_t
*mutex
, const pthread_mutexattr_t
*mutexattr
),
159 (mutex
, mutexattr
), 0)
161 FORWARD (pthread_mutex_lock
, (pthread_mutex_t
*mutex
), (mutex
), 0)
163 FORWARD (pthread_mutex_unlock
, (pthread_mutex_t
*mutex
), (mutex
), 0)
166 FORWARD2 (pthread_self
, pthread_t
, (void), (), return 0)
169 FORWARD (pthread_setcancelstate
, (int state
, int *oldstate
), (state
, oldstate
),
172 FORWARD (pthread_setcanceltype
, (int type
, int *oldtype
), (type
, oldtype
), 0)