chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / linuxthreads / forward.c
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.
4
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.
9
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.
14
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
18    02111-1307 USA.  */
19
20 #include <dlfcn.h>
21 #include "internals.h"
22 #include <stdlib.h>
23
24 #include <shlib-compat.h>
25
26
27 /* Pointers to the libc functions.  */
28 struct pthread_functions __libc_pthread_functions attribute_hidden;
29
30
31 # define FORWARD2(name, rettype, decl, params, defaction) \
32 rettype                                                                       \
33 name decl                                                                     \
34 {                                                                             \
35   if (__libc_pthread_functions.ptr_##name == NULL)                            \
36     defaction;                                                                \
37                                                                               \
38   return __libc_pthread_functions.ptr_##name params;                          \
39 }
40
41 # define FORWARD(name, decl, params, defretval) \
42   FORWARD2 (name, int, decl, params, return defretval)
43
44 FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0)
45
46 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
47 FORWARD (__pthread_attr_init_2_0, (pthread_attr_t *attr), (attr), 0)
48 compat_symbol (libc, __pthread_attr_init_2_0, pthread_attr_init, GLIBC_2_0);
49 #endif
50
51 FORWARD (__pthread_attr_init_2_1, (pthread_attr_t *attr), (attr), 0)
52 versioned_symbol (libc, __pthread_attr_init_2_1, pthread_attr_init, GLIBC_2_1);
53
54 FORWARD (pthread_attr_getdetachstate,
55          (const pthread_attr_t *attr, int *detachstate), (attr, detachstate),
56          0)
57 FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate),
58          (attr, detachstate), 0)
59
60 FORWARD (pthread_attr_getinheritsched,
61          (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0)
62 FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit),
63          (attr, inherit), 0)
64
65 FORWARD (pthread_attr_getschedparam,
66          (const pthread_attr_t *attr, struct sched_param *param),
67          (attr, param), 0)
68 FORWARD (pthread_attr_setschedparam,
69          (pthread_attr_t *attr, const struct sched_param *param),
70          (attr, param), 0)
71
72 FORWARD (pthread_attr_getschedpolicy,
73          (const pthread_attr_t *attr, int *policy), (attr, policy), 0)
74 FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy),
75          (attr, policy), 0)
76
77 FORWARD (pthread_attr_getscope,
78          (const pthread_attr_t *attr, int *scope), (attr, scope), 0)
79 FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope),
80          (attr, scope), 0)
81
82
83 FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0)
84 FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0)
85
86
87 FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0)
88 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
89 strong_alias (__pthread_cond_broadcast, __pthread_cond_broadcast_2_0)
90 compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast,
91                GLIBC_2_0);
92 #endif
93 versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast,
94                   GLIBC_2_3_2);
95
96 FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0)
97 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
98 strong_alias (__pthread_cond_destroy, __pthread_cond_destroy_2_0)
99 compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
100                GLIBC_2_0);
101 #endif
102 versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy,
103                   GLIBC_2_3_2);
104
105 FORWARD (__pthread_cond_init,
106          (pthread_cond_t *cond, const pthread_condattr_t *cond_attr),
107          (cond, cond_attr), 0)
108 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
109 strong_alias (__pthread_cond_init, __pthread_cond_init_2_0)
110 compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0);
111 #endif
112 versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_3_2);
113
114 FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0)
115 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
116 strong_alias (__pthread_cond_signal, __pthread_cond_signal_2_0)
117 compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal,
118                GLIBC_2_0);
119 #endif
120 versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal,
121                   GLIBC_2_3_2);
122
123 FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
124          (cond, mutex), 0)
125 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
126 strong_alias (__pthread_cond_wait, __pthread_cond_wait_2_0)
127 compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait, GLIBC_2_0);
128 #endif
129 versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2);
130
131 FORWARD (__pthread_cond_timedwait,
132          (pthread_cond_t *cond, pthread_mutex_t *mutex,
133           const struct timespec *abstime), (cond, mutex, abstime), 0)
134 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
135 strong_alias (__pthread_cond_timedwait, __pthread_cond_timedwait_2_0)
136 compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait, GLIBC_2_0);
137 #endif
138 versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_3_2);
139
140
141 FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
142          (thread1, thread2), 1)
143
144
145 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
146 FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
147 strong_alias (__pthread_exit, pthread_exit);
148
149
150 FORWARD (pthread_getschedparam,
151          (pthread_t target_thread, int *policy, struct sched_param *param),
152          (target_thread, policy, param), 0)
153 FORWARD (pthread_setschedparam,
154          (pthread_t target_thread, int policy,
155           const struct sched_param *param), (target_thread, policy, param), 0)
156
157
158 FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
159
160 FORWARD (pthread_mutex_init,
161          (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
162          (mutex, mutexattr), 0)
163
164 FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
165
166 FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
167
168
169 FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
170
171
172 FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
173          0)
174
175 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
176
177 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
178
179 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)