_pthread_stubs.c (152333) | _pthread_stubs.c (156319) |
---|---|
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 152333 2005-11-12 16:00:29Z deischen $"); | 28__FBSDID("$FreeBSD: head/lib/libc/gen/_pthread_stubs.c 156319 2006-03-05 18:10:28Z deischen $"); |
29 30#include <signal.h> 31#include <pthread.h> | 29 30#include <signal.h> 31#include <pthread.h> |
32#include <stdlib.h> |
|
32 33#include "libc_private.h" 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 --- 7 unchanged lines hidden (view full) --- 47}; 48 49static struct pthread main_thread; 50 51static int stub_main(void); 52static void *stub_null(void); 53static struct pthread *stub_self(void); 54static int stub_zero(void); | 33 34#include "libc_private.h" 35 36/* 37 * Weak symbols: All libc internal usage of these functions should 38 * use the weak symbol versions (_pthread_XXX). If libpthread is 39 * linked, it will override these functions with (non-weak) routines. 40 * The _pthread_XXX functions are provided solely for internal libc --- 7 unchanged lines hidden (view full) --- 48}; 49 50static struct pthread main_thread; 51 52static int stub_main(void); 53static void *stub_null(void); 54static struct pthread *stub_self(void); 55static int stub_zero(void); |
56static int stub_true(void); 57static void stub_exit(void); |
|
55 56#define PJT_DUAL_ENTRY(entry) \ 57 (pthread_func_t)entry, (pthread_func_t)entry 58 59pthread_func_entry_t __thr_jtable[PJT_MAX] = { | 58 59#define PJT_DUAL_ENTRY(entry) \ 60 (pthread_func_t)entry, (pthread_func_t)entry 61 62pthread_func_entry_t __thr_jtable[PJT_MAX] = { |
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 */ | 63 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATFORK */ 64 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_DESTROY */ 65 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETDETACHSTATE */ 66 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETGUARDSIZE */ 67 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETINHERITSCHED */ 68 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSCHEDPARAM */ 69 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSCHEDPOLICY */ 70 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSCOPE */ 71 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSTACKADDR */ 72 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSTACKSIZE */ 73 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_INIT */ 74 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETDETACHSTATE */ 75 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETGUARDSIZE */ 76 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETINHERITSCHED */ 77 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSCHEDPARAM */ 78 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSCHEDPOLICY */ 79 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSCOPE */ 80 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSTACKADDR */ 81 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSTACKSIZE */ 82 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CANCEL */ 83 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_POP */ 84 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_PUSH */ 85 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_BROADCAST */ 86 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_DESTROY */ 87 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_INIT */ 88 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_SIGNAL */ 89 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_TIMEDWAIT */ 90 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_WAIT */ 91 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_DETACH */ 92 {PJT_DUAL_ENTRY(stub_true)}, /* PJT_EQUAL */ 93 {PJT_DUAL_ENTRY(stub_exit)}, /* PJT_EXIT */ 94 {PJT_DUAL_ENTRY(stub_null)}, /* PJT_GETSPECIFIC */ 95 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_JOIN */ 96 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_CREATE */ 97 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_DELETE */ 98 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KILL */ 99 {PJT_DUAL_ENTRY(stub_main)}, /* PJT_MAIN_NP */ 100 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_DESTROY */ 101 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_INIT */ 102 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETTYPE */ 103 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_DESTROY */ 104 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_INIT */ 105 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_LOCK */ 106 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_TRYLOCK */ 107 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_UNLOCK */ 108 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ONCE */ 109 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_DESTROY */ 110 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_INIT */ 111 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_RDLOCK */ 112 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYRDLOCK */ 113 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYWRLOCK */ 114 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_UNLOCK */ 115 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_WRLOCK */ 116 {PJT_DUAL_ENTRY(stub_self)}, /* PJT_SELF */ 117 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETCANCELSTATE */ 118 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETCANCELTYPE */ 119 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETSPECIFIC */ 120 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SIGMASK */ 121 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_TESTCANCEL */ |
88}; 89 90/* 91 * Weak aliases for exported (pthread_*) and internal (_pthread_*) routines. 92 */ 93#define WEAK_REF(sym, alias) __weak_reference(sym, alias) 94 95#define FUNC_TYPE(name) __CONCAT(name, _func_t) --- 99 unchanged lines hidden (view full) --- 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 *) | 122}; 123 124/* 125 * Weak aliases for exported (pthread_*) and internal (_pthread_*) routines. 126 */ 127#define WEAK_REF(sym, alias) __weak_reference(sym, alias) 128 129#define FUNC_TYPE(name) __CONCAT(name, _func_t) --- 99 unchanged lines hidden (view full) --- 229STUB_FUNC1(pthread_rwlock_rdlock, PJT_RWLOCK_RDLOCK, int, void *) 230STUB_FUNC1(pthread_rwlock_tryrdlock, PJT_RWLOCK_TRYRDLOCK, int, void *) 231STUB_FUNC1(pthread_rwlock_trywrlock, PJT_RWLOCK_TRYWRLOCK, int, void *) 232STUB_FUNC1(pthread_rwlock_unlock, PJT_RWLOCK_UNLOCK, int, void *) 233STUB_FUNC1(pthread_rwlock_wrlock, PJT_RWLOCK_WRLOCK, int, void *) 234STUB_FUNC(pthread_self, PJT_SELF, pthread_t) 235STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *) 236STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *) |
237STUB_FUNC3(pthread_atfork, PJT_ATFORK, int, void *, void *, void*) 238STUB_FUNC1(pthread_attr_destroy, PJT_ATTR_DESTROY, int, void *); 239STUB_FUNC2(pthread_attr_getdetachstate, PJT_ATTR_GETDETACHSTATE, int, void *, void *) 240STUB_FUNC2(pthread_attr_getguardsize, PJT_ATTR_GETGUARDSIZE, int, void *, void *) 241STUB_FUNC2(pthread_attr_getstackaddr, PJT_ATTR_GETSTACKADDR, int, void *, void *) 242STUB_FUNC2(pthread_attr_getstacksize, PJT_ATTR_GETSTACKSIZE, int, void *, void *) 243STUB_FUNC2(pthread_attr_getinheritsched, PJT_ATTR_GETINHERITSCHED, int, void *, void *) 244STUB_FUNC2(pthread_attr_getschedparam, PJT_ATTR_GETSCHEDPARAM, int, void *, void *) 245STUB_FUNC2(pthread_attr_getschedpolicy, PJT_ATTR_GETSCHEDPOLICY, int, void *, void *) 246STUB_FUNC2(pthread_attr_getscope, PJT_ATTR_GETSCOPE, int, void *, void *) 247STUB_FUNC1(pthread_attr_init, PJT_ATTR_INIT, int, void *) 248STUB_FUNC2(pthread_attr_setdetachstate, PJT_ATTR_SETDETACHSTATE, int, void *, int) 249STUB_FUNC2(pthread_attr_setguardsize, PJT_ATTR_SETGUARDSIZE, int, void *, size_t) 250STUB_FUNC2(pthread_attr_setstackaddr, PJT_ATTR_SETSTACKADDR, int, void *, void *) 251STUB_FUNC2(pthread_attr_setstacksize, PJT_ATTR_SETSTACKSIZE, int, void *, size_t) 252STUB_FUNC2(pthread_attr_setinheritsched, PJT_ATTR_SETINHERITSCHED, int, void *, int) 253STUB_FUNC2(pthread_attr_setschedparam, PJT_ATTR_SETSCHEDPARAM, int, void *, void *) 254STUB_FUNC2(pthread_attr_setschedpolicy, PJT_ATTR_SETSCHEDPOLICY, int, void *, int) 255STUB_FUNC2(pthread_attr_setscope, PJT_ATTR_SETSCOPE, int, void *, int) 256STUB_FUNC1(pthread_cancel, PJT_CANCEL, int, void *) 257STUB_FUNC1(pthread_cleanup_pop, PJT_CLEANUP_POP, int, int) 258STUB_FUNC2(pthread_cleanup_push, PJT_CLEANUP_PUSH, void, void *, void *) 259STUB_FUNC3(pthread_cond_timedwait, PJT_COND_TIMEDWAIT, int, void *, void *, void *) 260STUB_FUNC1(pthread_detach, PJT_DETACH, int, void *) 261STUB_FUNC2(pthread_equal, PJT_EQUAL, int, void *, void *) 262STUB_FUNC1(pthread_exit, PJT_EXIT, void, void *) 263STUB_FUNC2(pthread_join, PJT_JOIN, int, void *, void *) 264STUB_FUNC2(pthread_kill, PJT_KILL, int, void *, int) 265STUB_FUNC2(pthread_setcancelstate, PJT_SETCANCELSTATE, int, int, void *) 266STUB_FUNC2(pthread_setcanceltype, PJT_SETCANCELTYPE, int, int, void *) 267STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void) |
|
203 204static int 205stub_zero(void) 206{ 207 return (0); 208} 209 210static void * --- 8 unchanged lines hidden (view full) --- 219 return (&main_thread); 220} 221 222static int 223stub_main(void) 224{ 225 return (-1); 226} | 268 269static int 270stub_zero(void) 271{ 272 return (0); 273} 274 275static void * --- 8 unchanged lines hidden (view full) --- 284 return (&main_thread); 285} 286 287static int 288stub_main(void) 289{ 290 return (-1); 291} |
292 293static int 294stub_true(void) 295{ 296 return (1); 297} 298 299static void 300stub_exit(void) 301{ 302 exit(0); 303} |
|