_pthread_stubs.c (106288) | _pthread_stubs.c (106866) |
---|---|
1/* 2 * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libc/gen/_pthread_stubs.c 106288 2002-11-01 09:37:17Z dfr $"); | 28__FBSDID("$FreeBSD: head/lib/libc/gen/_pthread_stubs.c 106866 2002-11-13 18:12:09Z deischen $"); |
29 30#include <signal.h> 31#include <pthread.h> | 29 30#include <signal.h> 31#include <pthread.h> |
32#include <pthread_np.h> | |
33 | 32 |
34void *_pthread_getspecific(pthread_key_t key); 35pthread_t _pthread_self(void); | 33#include "libc_private.h" |
36 37/* 38 * Weak symbols: All libc internal usage of these functions should 39 * use the weak symbol versions (_pthread_XXX). If libpthread is 40 * linked, it will override these functions with (non-weak) routines. 41 * The _pthread_XXX functions are provided solely for internal libc 42 * usage to avoid unwanted cancellation points and to differentiate 43 * between application locks and libc locks (threads holding the 44 * latter can't be allowed to exit/terminate). | 34 35/* 36 * Weak symbols: All libc internal usage of these functions should 37 * use the weak symbol versions (_pthread_XXX). If libpthread is 38 * linked, it will override these functions with (non-weak) routines. 39 * The _pthread_XXX functions are provided solely for internal libc 40 * usage to avoid unwanted cancellation points and to differentiate 41 * between application locks and libc locks (threads holding the 42 * latter can't be allowed to exit/terminate). |
45 * 46 * We also provide weak pthread_XXX stubs which call their 47 * _pthread_XXX counterparts. These stubs may be used be other 48 * libraries for ensuring thread-safety without requiring the presence 49 * of a thread library. | |
50 */ | 43 */ |
51__weak_reference(_pthread_cond_init_stub, _pthread_cond_init); 52__weak_reference(_pthread_cond_signal_stub, _pthread_cond_signal); 53__weak_reference(_pthread_cond_broadcast_stub, _pthread_cond_broadcast); 54__weak_reference(_pthread_cond_wait_stub, _pthread_cond_wait); 55__weak_reference(_pthread_cond_destroy_stub, _pthread_cond_destroy); 56__weak_reference(_pthread_getspecific_stub, _pthread_getspecific); 57__weak_reference(_pthread_key_create_stub, _pthread_key_create); 58__weak_reference(_pthread_key_delete_stub, _pthread_key_delete); 59__weak_reference(_pthread_main_np_stub, _pthread_main_np); 60__weak_reference(_pthread_mutex_destroy_stub, _pthread_mutex_destroy); 61__weak_reference(_pthread_mutex_init_stub, _pthread_mutex_init); 62__weak_reference(_pthread_mutex_lock_stub, _pthread_mutex_lock); 63__weak_reference(_pthread_mutex_trylock_stub, _pthread_mutex_trylock); 64__weak_reference(_pthread_mutex_unlock_stub, _pthread_mutex_unlock); 65__weak_reference(_pthread_mutexattr_init_stub, _pthread_mutexattr_init); 66__weak_reference(_pthread_mutexattr_destroy_stub, _pthread_mutexattr_destroy); 67__weak_reference(_pthread_mutexattr_settype_stub, _pthread_mutexattr_settype); 68__weak_reference(_pthread_once_stub, _pthread_once); 69__weak_reference(_pthread_self_stub, _pthread_self); 70__weak_reference(_pthread_rwlock_init_stub, _pthread_rwlock_init); 71__weak_reference(_pthread_rwlock_destroy_stub, _pthread_rwlock_destroy); 72__weak_reference(_pthread_rwlock_rdlock_stub, _pthread_rwlock_rdlock); 73__weak_reference(_pthread_rwlock_tryrdlock_stub, _pthread_rwlock_tryrdlock); 74__weak_reference(_pthread_rwlock_trywrlock_stub, _pthread_rwlock_trywrlock); 75__weak_reference(_pthread_rwlock_unlock_stub, _pthread_rwlock_unlock); 76__weak_reference(_pthread_rwlock_wrlock_stub, _pthread_rwlock_wrlock); 77__weak_reference(_pthread_setspecific_stub, _pthread_setspecific); 78__weak_reference(_pthread_sigmask_stub, _pthread_sigmask); | |
79 | 44 |
80__weak_reference(pthread_cond_init_stub, pthread_cond_init); 81__weak_reference(pthread_cond_signal_stub, pthread_cond_signal); 82__weak_reference(pthread_cond_broadcast_stub, pthread_cond_broadcast); 83__weak_reference(pthread_cond_wait_stub, pthread_cond_wait); 84__weak_reference(pthread_cond_destroy_stub, pthread_cond_destroy); 85__weak_reference(pthread_getspecific_stub, pthread_getspecific); 86__weak_reference(pthread_key_create_stub, pthread_key_create); 87__weak_reference(pthread_key_delete_stub, pthread_key_delete); 88__weak_reference(pthread_main_np_stub, pthread_main_np); 89__weak_reference(pthread_mutex_destroy_stub, pthread_mutex_destroy); 90__weak_reference(pthread_mutex_init_stub, pthread_mutex_init); 91__weak_reference(pthread_mutex_lock_stub, pthread_mutex_lock); 92__weak_reference(pthread_mutex_trylock_stub, pthread_mutex_trylock); 93__weak_reference(pthread_mutex_unlock_stub, pthread_mutex_unlock); 94__weak_reference(pthread_mutexattr_init_stub, pthread_mutexattr_init); 95__weak_reference(pthread_mutexattr_destroy_stub, pthread_mutexattr_destroy); 96__weak_reference(pthread_mutexattr_settype_stub, pthread_mutexattr_settype); 97__weak_reference(pthread_once_stub, pthread_once); 98__weak_reference(pthread_self_stub, pthread_self); 99__weak_reference(pthread_rwlock_init_stub, pthread_rwlock_init); 100__weak_reference(pthread_rwlock_destroy_stub, pthread_rwlock_destroy); 101__weak_reference(pthread_rwlock_rdlock_stub, pthread_rwlock_rdlock); 102__weak_reference(pthread_rwlock_tryrdlock_stub, pthread_rwlock_tryrdlock); 103__weak_reference(pthread_rwlock_trywrlock_stub, pthread_rwlock_trywrlock); 104__weak_reference(pthread_rwlock_unlock_stub, pthread_rwlock_unlock); 105__weak_reference(pthread_rwlock_wrlock_stub, pthread_rwlock_wrlock); 106__weak_reference(pthread_setspecific_stub, pthread_setspecific); 107__weak_reference(pthread_sigmask_stub, pthread_sigmask); 108 | |
109/* Define a null pthread structure just to satisfy _pthread_self. */ 110struct pthread { 111}; 112 113static struct pthread main_thread; 114 | 45/* Define a null pthread structure just to satisfy _pthread_self. */ 46struct pthread { 47}; 48 49static struct pthread main_thread; 50 |
115static int 116_pthread_cond_init_stub(pthread_cond_t *cond, 117 const pthread_condattr_t *cond_attr) 118{ 119 return (0); 120} | 51static int stub_main(void); 52static void *stub_null(void); 53static struct pthread *stub_self(void); 54static int stub_zero(void); |
121 | 55 |
122static int 123_pthread_cond_signal_stub(pthread_cond_t *cond) 124{ 125 return (0); 126} | 56#define PJT_DUAL_ENTRY(entry) \ 57 (pthread_func_t)entry, (pthread_func_t)entry |
127 | 58 |
128static int 129_pthread_cond_broadcast_stub(pthread_cond_t *cond) 130{ 131 return (0); 132} | 59pthread_func_t __thr_jtable[PJT_MAX][2] = { 60 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_BROADCAST */ 61 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_DESTROY */ 62 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_INIT */ 63 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_SIGNAL */ 64 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_WAIT */ 65 {PJT_DUAL_ENTRY(stub_null)}, /* PJT_GETSPECIFIC */ 66 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_CREATE */ 67 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_DELETE */ 68 {PJT_DUAL_ENTRY(stub_main)}, /* PJT_MAIN_NP */ 69 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_DESTROY */ 70 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_INIT */ 71 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_LOCK */ 72 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_TRYLOCK */ 73 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_UNLOCK */ 74 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_DESTROY */ 75 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_INIT */ 76 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETTYPE */ 77 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ONCE */ 78 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_DESTROY */ 79 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_INIT */ 80 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_RDLOCK */ 81 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYRDLOCK */ 82 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYWRLOCK */ 83 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_UNLOCK */ 84 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_WRLOCK */ 85 {PJT_DUAL_ENTRY(stub_self)}, /* PJT_SELF */ 86 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETSPECIFIC */ 87 {PJT_DUAL_ENTRY(stub_zero)} /* PJT_SIGMASK */ 88}; |
133 | 89 |
134static int 135_pthread_cond_wait_stub(pthread_cond_t *cond, pthread_mutex_t *mutex) 136{ 137 return (0); 138} | 90/* 91 * Weak aliases for exported (pthread_*) and internal (_pthread_*) routines. 92 */ 93#define WEAK_REF(sym, alias) __weak_reference(sym, alias) |
139 | 94 |
140static int 141_pthread_cond_destroy_stub(pthread_cond_t *cond) 142{ 143 return (0); 144} | 95#define FUNC_TYPE(name) __CONCAT(name, _func_t) 96#define FUNC_INT(name) __CONCAT(name, _int) 97#define FUNC_EXP(name) __CONCAT(name, _exp) |
145 | 98 |
146static void * 147_pthread_getspecific_stub(pthread_key_t key) 148{ 149 return (NULL); 150} | 99#define STUB_FUNC(name, idx, ret) \ 100 static ret FUNC_EXP(name)(void) __unused; \ 101 static ret FUNC_INT(name)(void) __unused; \ 102 WEAK_REF(FUNC_EXP(name), name); \ 103 WEAK_REF(FUNC_INT(name), __CONCAT(_, name)); \ 104 typedef ret (*FUNC_TYPE(name))(void); \ 105 static ret FUNC_EXP(name)(void) \ 106 { \ 107 FUNC_TYPE(name) func; \ 108 func = (FUNC_TYPE(name))__thr_jtable[idx][0]; \ 109 return (func()); \ 110 } \ 111 static ret FUNC_INT(name)(void) \ 112 { \ 113 FUNC_TYPE(name) func; \ 114 func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \ 115 return (func()); \ 116 } |
151 | 117 |
152static int 153_pthread_key_create_stub(pthread_key_t *key, void (*destructor) (void *)) 154{ 155 return (0); 156} | 118#define STUB_FUNC1(name, idx, ret, p0_type) \ 119 static ret FUNC_EXP(name)(p0_type) __unused; \ 120 static ret FUNC_INT(name)(p0_type) __unused; \ 121 WEAK_REF(FUNC_EXP(name), name); \ 122 WEAK_REF(FUNC_INT(name), __CONCAT(_, name)); \ 123 typedef ret (*FUNC_TYPE(name))(p0_type); \ 124 static ret FUNC_EXP(name)(p0_type p0) \ 125 { \ 126 FUNC_TYPE(name) func; \ 127 func = (FUNC_TYPE(name))__thr_jtable[idx][0]; \ 128 return (func(p0)); \ 129 } \ 130 static ret FUNC_INT(name)(p0_type p0) \ 131 { \ 132 FUNC_TYPE(name) func; \ 133 func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \ 134 return (func(p0)); \ 135 } |
157 | 136 |
158static int 159_pthread_key_delete_stub(pthread_key_t key) 160{ 161 return (0); 162} | 137#define STUB_FUNC2(name, idx, ret, p0_type, p1_type) \ 138 static ret FUNC_EXP(name)(p0_type, p1_type) __unused; \ 139 static ret FUNC_INT(name)(p0_type, p1_type) __unused; \ 140 WEAK_REF(FUNC_EXP(name), name); \ 141 WEAK_REF(FUNC_INT(name), __CONCAT(_, name)); \ 142 typedef ret (*FUNC_TYPE(name))(p0_type, p1_type); \ 143 static ret FUNC_EXP(name)(p0_type p0, p1_type p1) \ 144 { \ 145 FUNC_TYPE(name) func; \ 146 func = (FUNC_TYPE(name))__thr_jtable[idx][0]; \ 147 return (func(p0, p1)); \ 148 } \ 149 static ret FUNC_INT(name)(p0_type p0, p1_type p1) \ 150 { \ 151 FUNC_TYPE(name) func; \ 152 func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \ 153 return (func(p0, p1)); \ 154 } |
163 | 155 |
164static int 165_pthread_main_np_stub() 166{ 167 return (-1); 168} | 156#define STUB_FUNC3(name, idx, ret, p0_type, p1_type, p2_type) \ 157 static ret FUNC_EXP(name)(p0_type, p1_type, p2_type) __unused; \ 158 static ret FUNC_INT(name)(p0_type, p1_type, p2_type) __unused; \ 159 WEAK_REF(FUNC_EXP(name), name); \ 160 WEAK_REF(FUNC_INT(name), __CONCAT(_, name)); \ 161 typedef ret (*FUNC_TYPE(name))(p0_type, p1_type, p2_type); \ 162 static ret FUNC_EXP(name)(p0_type p0, p1_type p1, p2_type p2) \ 163 { \ 164 FUNC_TYPE(name) func; \ 165 func = (FUNC_TYPE(name))__thr_jtable[idx][0]; \ 166 return (func(p0, p1, p2)); \ 167 } \ 168 static ret FUNC_INT(name)(p0_type p0, p1_type p1, p2_type p2) \ 169 { \ 170 FUNC_TYPE(name) func; \ 171 func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \ 172 return (func(p0, p1, p2)); \ 173 } |
169 | 174 |
170static int 171_pthread_mutex_destroy_stub(pthread_mutex_t *mattr) 172{ 173 return (0); 174} | 175STUB_FUNC1(pthread_cond_broadcast, PJT_COND_BROADCAST, int, void *) 176STUB_FUNC1(pthread_cond_destroy, PJT_COND_DESTROY, int, void *) 177STUB_FUNC2(pthread_cond_init, PJT_COND_INIT, int, void *, void *) 178STUB_FUNC1(pthread_cond_signal, PJT_COND_SIGNAL, int, void *) 179STUB_FUNC1(pthread_cond_wait, PJT_COND_WAIT, int, void *) 180STUB_FUNC1(pthread_getspecific, PJT_GETSPECIFIC, void *, pthread_key_t) 181STUB_FUNC2(pthread_key_create, PJT_KEY_CREATE, int, void *, void *) 182STUB_FUNC1(pthread_key_delete, PJT_KEY_DELETE, int, pthread_key_t) 183STUB_FUNC(pthread_main_np, PJT_MAIN_NP, int) 184STUB_FUNC1(pthread_mutex_destroy, PJT_MUTEX_DESTROY, int, void *) 185STUB_FUNC2(pthread_mutex_init, PJT_MUTEX_INIT, int, void *, void *) 186STUB_FUNC1(pthread_mutex_lock, PJT_MUTEX_LOCK, int, void *) 187STUB_FUNC1(pthread_mutex_trylock, PJT_MUTEX_TRYLOCK, int, void *) 188STUB_FUNC1(pthread_mutex_unlock, PJT_MUTEX_UNLOCK, int, void *) 189STUB_FUNC1(pthread_mutexattr_destroy, PJT_MUTEXATTR_DESTROY, int, void *) 190STUB_FUNC1(pthread_mutexattr_init, PJT_MUTEXATTR_INIT, int, void *) 191STUB_FUNC1(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *) 192STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *) 193STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *) 194STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *) 195STUB_FUNC1(pthread_rwlock_rdlock, PJT_RWLOCK_RDLOCK, int, void *) 196STUB_FUNC1(pthread_rwlock_tryrdlock, PJT_RWLOCK_TRYRDLOCK, int, void *) 197STUB_FUNC1(pthread_rwlock_trywrlock, PJT_RWLOCK_TRYWRLOCK, int, void *) 198STUB_FUNC1(pthread_rwlock_unlock, PJT_RWLOCK_UNLOCK, int, void *) 199STUB_FUNC1(pthread_rwlock_wrlock, PJT_RWLOCK_WRLOCK, int, void *) 200STUB_FUNC(pthread_self, PJT_SELF, pthread_t) 201STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *) 202STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *) |
175 176static int | 203 204static int |
177_pthread_mutex_init_stub(pthread_mutex_t *mutex, const pthread_mutexattr_t *mattr) | 205stub_zero(void) |
178{ 179 return (0); 180} 181 | 206{ 207 return (0); 208} 209 |
182static int 183_pthread_mutex_lock_stub(pthread_mutex_t *mutex) | 210static void * 211stub_null(void) |
184{ | 212{ |
185 return (0); | 213 return (NULL); |
186} 187 | 214} 215 |
188static int 189_pthread_mutex_trylock_stub(pthread_mutex_t *mutex) | 216static struct pthread * 217stub_self(void) |
190{ | 218{ |
191 return (0); 192} 193 194static int 195_pthread_mutex_unlock_stub(pthread_mutex_t *mutex) 196{ 197 return (0); 198} 199 200static int 201_pthread_mutexattr_init_stub(pthread_mutexattr_t *mattr) 202{ 203 return (0); 204} 205 206static int 207_pthread_mutexattr_destroy_stub(pthread_mutexattr_t *mattr) 208{ 209 return (0); 210} 211 212static int 213_pthread_mutexattr_settype_stub(pthread_mutexattr_t *mattr, int type) 214{ 215 return (0); 216} 217 218static int 219_pthread_once_stub(pthread_once_t *once_control, void (*init_routine) (void)) 220{ 221 return (0); 222} 223 224static int 225_pthread_rwlock_init_stub(pthread_rwlock_t *rwlock, 226 const pthread_rwlockattr_t *attr) 227{ 228 return (0); 229} 230 231static int 232_pthread_rwlock_destroy_stub(pthread_rwlock_t *rwlock) 233{ 234 return (0); 235} 236 237static int 238_pthread_rwlock_rdlock_stub(pthread_rwlock_t *rwlock) 239{ 240 return (0); 241} 242 243static int 244_pthread_rwlock_tryrdlock_stub(pthread_rwlock_t *rwlock) 245{ 246 return (0); 247} 248 249static int 250_pthread_rwlock_trywrlock_stub(pthread_rwlock_t *rwlock) 251{ 252 return (0); 253} 254 255static int 256_pthread_rwlock_unlock_stub(pthread_rwlock_t *rwlock) 257{ 258 return (0); 259} 260 261static int 262_pthread_rwlock_wrlock_stub(pthread_rwlock_t *rwlock) 263{ 264 return (0); 265} 266 267static pthread_t 268_pthread_self_stub(void) 269{ | |
270 return (&main_thread); 271} 272 273static int | 219 return (&main_thread); 220} 221 222static int |
274_pthread_setspecific_stub(pthread_key_t key, const void *value) | 223stub_main(void) |
275{ | 224{ |
276 return (0); | 225 return (-1); |
277} | 226} |
278 279static int 280_pthread_sigmask_stub(int how, const sigset_t *set, sigset_t *oset) 281{ 282 return (0); 283} 284 285static int 286pthread_cond_init_stub(pthread_cond_t *cond, 287 const pthread_condattr_t *cond_attr) 288{ 289 return (_pthread_cond_init(cond, cond_attr)); 290} 291 292static int 293pthread_cond_signal_stub(pthread_cond_t *cond) 294{ 295 return (_pthread_cond_signal(cond)); 296} 297 298static int 299pthread_cond_broadcast_stub(pthread_cond_t *cond) 300{ 301 return (_pthread_cond_broadcast(cond)); 302} 303 304static int 305pthread_cond_wait_stub(pthread_cond_t *cond, pthread_mutex_t *mutex) 306{ 307 return (_pthread_cond_wait(cond, mutex)); 308} 309 310static int 311pthread_cond_destroy_stub(pthread_cond_t *cond) 312{ 313 return (_pthread_cond_destroy(cond)); 314} 315 316static void * 317pthread_getspecific_stub(pthread_key_t key) 318{ 319 return (_pthread_getspecific(key)); 320} 321 322static int 323pthread_key_create_stub(pthread_key_t *key, void (*destructor) (void *)) 324{ 325 return (_pthread_key_create(key, destructor)); 326} 327 328static int 329pthread_key_delete_stub(pthread_key_t key) 330{ 331 return (_pthread_key_delete(key)); 332} 333 334static int 335pthread_main_np_stub() 336{ 337 return (_pthread_main_np()); 338} 339 340static int 341pthread_mutex_destroy_stub(pthread_mutex_t *mattr) 342{ 343 return (_pthread_mutex_destroy(mattr)); 344} 345 346static int 347pthread_mutex_init_stub(pthread_mutex_t *mutex, const pthread_mutexattr_t *mattr) 348{ 349 return (_pthread_mutex_init(mutex, mattr)); 350} 351 352static int 353pthread_mutex_lock_stub(pthread_mutex_t *mutex) 354{ 355 return (_pthread_mutex_lock(mutex)); 356} 357 358static int 359pthread_mutex_trylock_stub(pthread_mutex_t *mutex) 360{ 361 return (_pthread_mutex_trylock(mutex)); 362} 363 364static int 365pthread_mutex_unlock_stub(pthread_mutex_t *mutex) 366{ 367 return (_pthread_mutex_unlock(mutex)); 368} 369 370static int 371pthread_mutexattr_init_stub(pthread_mutexattr_t *mattr) 372{ 373 return (_pthread_mutexattr_init(mattr)); 374} 375 376static int 377pthread_mutexattr_destroy_stub(pthread_mutexattr_t *mattr) 378{ 379 return (_pthread_mutexattr_destroy(mattr)); 380} 381 382static int 383pthread_mutexattr_settype_stub(pthread_mutexattr_t *mattr, int type) 384{ 385 return (_pthread_mutexattr_settype(mattr, type)); 386} 387 388static int 389pthread_once_stub(pthread_once_t *once_control, void (*init_routine) (void)) 390{ 391 return (_pthread_once(once_control, init_routine)); 392} 393 394static int 395pthread_rwlock_init_stub(pthread_rwlock_t *rwlock, 396 const pthread_rwlockattr_t *attr) 397{ 398 return (_pthread_rwlock_init(rwlock, attr)); 399} 400 401static int 402pthread_rwlock_destroy_stub(pthread_rwlock_t *rwlock) 403{ 404 return (_pthread_rwlock_destroy(rwlock)); 405} 406 407static int 408pthread_rwlock_rdlock_stub(pthread_rwlock_t *rwlock) 409{ 410 return (_pthread_rwlock_rdlock(rwlock)); 411} 412 413static int 414pthread_rwlock_tryrdlock_stub(pthread_rwlock_t *rwlock) 415{ 416 return (_pthread_rwlock_tryrdlock(rwlock)); 417} 418 419static int 420pthread_rwlock_trywrlock_stub(pthread_rwlock_t *rwlock) 421{ 422 return (_pthread_rwlock_trywrlock(rwlock)); 423} 424 425static int 426pthread_rwlock_unlock_stub(pthread_rwlock_t *rwlock) 427{ 428 return (_pthread_rwlock_unlock(rwlock)); 429} 430 431static int 432pthread_rwlock_wrlock_stub(pthread_rwlock_t *rwlock) 433{ 434 return (_pthread_rwlock_wrlock(rwlock)); 435} 436 437static pthread_t 438pthread_self_stub(void) 439{ 440 return (_pthread_self()); 441} 442 443static int 444pthread_setspecific_stub(pthread_key_t key, const void *value) 445{ 446 return (_pthread_setspecific(key, value)); 447} 448 449static int 450pthread_sigmask_stub(int how, const sigset_t *set, sigset_t *oset) 451{ 452 return (_pthread_sigmask(how, set, oset)); 453} | |