Back to index

glibc  2.9
forward.c
Go to the documentation of this file.
00001 /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <dlfcn.h>
00021 #include "internals.h"
00022 #include <stdlib.h>
00023 
00024 #include <shlib-compat.h>
00025 
00026 
00027 /* Pointers to the libc functions.  */
00028 struct pthread_functions __libc_pthread_functions attribute_hidden;
00029 
00030 
00031 # define FORWARD2(name, rettype, decl, params, defaction) \
00032 rettype                                                                     \
00033 name decl                                                            \
00034 {                                                                    \
00035   if (__libc_pthread_functions.ptr_##name == NULL)                          \
00036     defaction;                                                              \
00037                                                                      \
00038   return __libc_pthread_functions.ptr_##name params;                        \
00039 }
00040 
00041 # define FORWARD(name, decl, params, defretval) \
00042   FORWARD2 (name, int, decl, params, return defretval)
00043 
00044 FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0)
00045 
00046 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
00047 FORWARD (__pthread_attr_init_2_0, (pthread_attr_t *attr), (attr), 0)
00048 compat_symbol (libc, __pthread_attr_init_2_0, pthread_attr_init, GLIBC_2_0);
00049 #endif
00050 
00051 FORWARD (__pthread_attr_init_2_1, (pthread_attr_t *attr), (attr), 0)
00052 versioned_symbol (libc, __pthread_attr_init_2_1, pthread_attr_init, GLIBC_2_1);
00053 
00054 FORWARD (pthread_attr_getdetachstate,
00055         (const pthread_attr_t *attr, int *detachstate), (attr, detachstate),
00056         0)
00057 FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate),
00058         (attr, detachstate), 0)
00059 
00060 FORWARD (pthread_attr_getinheritsched,
00061         (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0)
00062 FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit),
00063         (attr, inherit), 0)
00064 
00065 FORWARD (pthread_attr_getschedparam,
00066         (const pthread_attr_t *attr, struct sched_param *param),
00067         (attr, param), 0)
00068 FORWARD (pthread_attr_setschedparam,
00069         (pthread_attr_t *attr, const struct sched_param *param),
00070         (attr, param), 0)
00071 
00072 FORWARD (pthread_attr_getschedpolicy,
00073         (const pthread_attr_t *attr, int *policy), (attr, policy), 0)
00074 FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy),
00075         (attr, policy), 0)
00076 
00077 FORWARD (pthread_attr_getscope,
00078         (const pthread_attr_t *attr, int *scope), (attr, scope), 0)
00079 FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope),
00080         (attr, scope), 0)
00081 
00082 
00083 FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0)
00084 FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0)
00085 
00086 
00087 FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0)
00088 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
00089 strong_alias (__pthread_cond_broadcast, __pthread_cond_broadcast_2_0)
00090 compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast,
00091               GLIBC_2_0);
00092 #endif
00093 versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast,
00094                 GLIBC_2_3_2);
00095 
00096 FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0)
00097 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
00098 strong_alias (__pthread_cond_destroy, __pthread_cond_destroy_2_0)
00099 compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
00100               GLIBC_2_0);
00101 #endif
00102 versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy,
00103                 GLIBC_2_3_2);
00104 
00105 FORWARD (__pthread_cond_init,
00106         (pthread_cond_t *cond, const pthread_condattr_t *cond_attr),
00107         (cond, cond_attr), 0)
00108 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
00109 strong_alias (__pthread_cond_init, __pthread_cond_init_2_0)
00110 compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0);
00111 #endif
00112 versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_3_2);
00113 
00114 FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0)
00115 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
00116 strong_alias (__pthread_cond_signal, __pthread_cond_signal_2_0)
00117 compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal,
00118               GLIBC_2_0);
00119 #endif
00120 versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal,
00121                 GLIBC_2_3_2);
00122 
00123 FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
00124         (cond, mutex), 0)
00125 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
00126 strong_alias (__pthread_cond_wait, __pthread_cond_wait_2_0)
00127 compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait, GLIBC_2_0);
00128 #endif
00129 versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2);
00130 
00131 FORWARD (__pthread_cond_timedwait,
00132         (pthread_cond_t *cond, pthread_mutex_t *mutex,
00133          const struct timespec *abstime), (cond, mutex, abstime), 0)
00134 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
00135 strong_alias (__pthread_cond_timedwait, __pthread_cond_timedwait_2_0)
00136 compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait, GLIBC_2_0);
00137 #endif
00138 versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_3_2);
00139 
00140 
00141 FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
00142         (thread1, thread2), 1)
00143 
00144 
00145 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
00146 FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
00147 strong_alias (__pthread_exit, pthread_exit);
00148 
00149 
00150 FORWARD (pthread_getschedparam,
00151         (pthread_t target_thread, int *policy, struct sched_param *param),
00152         (target_thread, policy, param), 0)
00153 FORWARD (pthread_setschedparam,
00154         (pthread_t target_thread, int policy,
00155          const struct sched_param *param), (target_thread, policy, param), 0)
00156 
00157 
00158 FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
00159 
00160 FORWARD (pthread_mutex_init,
00161         (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
00162         (mutex, mutexattr), 0)
00163 
00164 FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
00165 
00166 FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
00167 
00168 
00169 FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
00170 
00171 
00172 FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
00173         0)
00174 
00175 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
00176 
00177 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
00178 
00179 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)