file tst-timer.c was initially added on branch fedora-branch.
[glibc/history.git] / nptl / forward.c
blobe5f93d475ed4641c1a88e579e26ac68c6e7d5fae
1 /* Copyright (C) 2002, 2003, 2004 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
18 02111-1307 USA. */
20 #include <dlfcn.h>
21 #include <pthreadP.h>
22 #include <signal.h>
23 #include <stdlib.h>
25 #include <shlib-compat.h>
26 #include <atomic.h>
27 #include <sysdep.h>
30 /* Pointers to the libc functions. */
31 struct pthread_functions __libc_pthread_functions attribute_hidden;
34 #define FORWARD2(name, rettype, decl, params, defaction) \
35 rettype \
36 name decl \
37 { \
38 if (__libc_pthread_functions.ptr_##name == NULL) \
39 defaction; \
41 return __libc_pthread_functions.ptr_##name params; \
44 #define FORWARD(name, decl, params, defretval) \
45 FORWARD2 (name, int, decl, params, return defretval)
48 FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0)
50 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
51 FORWARD (__pthread_attr_init_2_0, (pthread_attr_t *attr), (attr), 0)
52 compat_symbol (libc, __pthread_attr_init_2_0, pthread_attr_init, GLIBC_2_0);
53 #endif
55 FORWARD (__pthread_attr_init_2_1, (pthread_attr_t *attr), (attr), 0)
56 versioned_symbol (libc, __pthread_attr_init_2_1, pthread_attr_init, GLIBC_2_1);
58 FORWARD (pthread_attr_getdetachstate,
59 (const pthread_attr_t *attr, int *detachstate), (attr, detachstate),
61 FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate),
62 (attr, detachstate), 0)
64 FORWARD (pthread_attr_getinheritsched,
65 (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0)
66 FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit),
67 (attr, inherit), 0)
69 FORWARD (pthread_attr_getschedparam,
70 (const pthread_attr_t *attr, struct sched_param *param),
71 (attr, param), 0)
72 FORWARD (pthread_attr_setschedparam,
73 (pthread_attr_t *attr, const struct sched_param *param),
74 (attr, param), 0)
76 FORWARD (pthread_attr_getschedpolicy,
77 (const pthread_attr_t *attr, int *policy), (attr, policy), 0)
78 FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy),
79 (attr, policy), 0)
81 FORWARD (pthread_attr_getscope,
82 (const pthread_attr_t *attr, int *scope), (attr, scope), 0)
83 FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope),
84 (attr, scope), 0)
87 FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0)
88 FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0)
90 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
91 FORWARD2 (__pthread_cond_broadcast_2_0, int attribute_compat_text_section,
92 (pthread_cond_2_0_t *cond), (cond), return 0)
93 compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast,
94 GLIBC_2_0);
95 #endif
96 FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0)
97 versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast,
98 GLIBC_2_3_2);
100 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
101 FORWARD2 (__pthread_cond_destroy_2_0, int attribute_compat_text_section,
102 (pthread_cond_2_0_t *cond), (cond), return 0)
103 compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
104 GLIBC_2_0);
105 #endif
106 FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0)
107 versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy,
108 GLIBC_2_3_2);
110 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
111 FORWARD2 (__pthread_cond_init_2_0, int attribute_compat_text_section,
112 (pthread_cond_2_0_t *cond, const pthread_condattr_t *cond_attr),
113 (cond, cond_attr), return 0)
114 compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0);
115 #endif
116 FORWARD (__pthread_cond_init,
117 (pthread_cond_t *cond, const pthread_condattr_t *cond_attr),
118 (cond, cond_attr), 0)
119 versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_3_2);
121 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
122 FORWARD2 (__pthread_cond_signal_2_0, int attribute_compat_text_section,
123 (pthread_cond_2_0_t *cond), (cond), return 0)
124 compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal,
125 GLIBC_2_0);
126 #endif
127 FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0)
128 versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal,
129 GLIBC_2_3_2);
131 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
132 FORWARD2 (__pthread_cond_wait_2_0, int attribute_compat_text_section,
133 (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex), (cond, mutex),
134 return 0)
135 compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait,
136 GLIBC_2_0);
137 #endif
138 FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
139 (cond, mutex), 0)
140 versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait,
141 GLIBC_2_3_2);
143 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
144 FORWARD2 (__pthread_cond_timedwait_2_0, int attribute_compat_text_section,
145 (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex,
146 const struct timespec *abstime), (cond, mutex, abstime),
147 return 0)
148 compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait,
149 GLIBC_2_0);
150 #endif
151 FORWARD (__pthread_cond_timedwait,
152 (pthread_cond_t *cond, pthread_mutex_t *mutex,
153 const struct timespec *abstime), (cond, mutex, abstime), 0)
154 versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait,
155 GLIBC_2_3_2);
158 FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
159 (thread1, thread2), 1)
162 /* Use an alias to avoid warning, as pthread_exit is declared noreturn. */
163 FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
164 strong_alias (__pthread_exit, pthread_exit);
167 FORWARD (pthread_getschedparam,
168 (pthread_t target_thread, int *policy, struct sched_param *param),
169 (target_thread, policy, param), 0)
170 FORWARD (pthread_setschedparam,
171 (pthread_t target_thread, int policy,
172 const struct sched_param *param), (target_thread, policy, param), 0)
175 FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
177 FORWARD (pthread_mutex_init,
178 (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
179 (mutex, mutexattr), 0)
181 FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
183 FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
186 FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
189 FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
192 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
194 #define return /* value is void */
195 FORWARD2(__pthread_unwind,
196 void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute
197 attribute_compat_text_section,
198 (__pthread_unwind_buf_t *buf), (buf), {
199 /* We cannot call abort() here. */
200 INTERNAL_SYSCALL_DECL (err);
201 INTERNAL_SYSCALL (kill, err, 1, SIGKILL);
203 #undef return