Deleted Added
full compact
_pthread_stubs.c (213153) _pthread_stubs.c (227999)
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 213153 2010-09-25 01:57:47Z davidxu $");
28__FBSDID("$FreeBSD: head/lib/libc/gen/_pthread_stubs.c 227999 2011-11-26 15:57:09Z theraven $");
29
30#include <signal.h>
31#include <pthread.h>
32#include <stdlib.h>
29
30#include <signal.h>
31#include <pthread.h>
32#include <stdlib.h>
33#include <errno.h>
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);
34
35#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

--- 7 unchanged lines hidden (view full) ---

49};
50
51static struct pthread main_thread;
52
53static int stub_main(void);
54static void *stub_null(void);
55static struct pthread *stub_self(void);
56static int stub_zero(void);
57static int stub_fail(void);
56static int stub_true(void);
57static void stub_exit(void);
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] = {
63 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATFORK */

--- 24 unchanged lines hidden (view full) ---

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 */
58static int stub_true(void);
59static void stub_exit(void);
60
61#define PJT_DUAL_ENTRY(entry) \
62 (pthread_func_t)entry, (pthread_func_t)entry
63
64pthread_func_entry_t __thr_jtable[PJT_MAX] = {
65 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATFORK */

--- 24 unchanged lines hidden (view full) ---

90 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_SIGNAL */
91 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_TIMEDWAIT */
92 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_WAIT */
93 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_DETACH */
94 {PJT_DUAL_ENTRY(stub_true)}, /* PJT_EQUAL */
95 {PJT_DUAL_ENTRY(stub_exit)}, /* PJT_EXIT */
96 {PJT_DUAL_ENTRY(stub_null)}, /* PJT_GETSPECIFIC */
97 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_JOIN */
96 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_CREATE */
98 {PJT_DUAL_ENTRY(stub_fail)}, /* 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 */
99 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_DELETE */
100 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KILL */
101 {PJT_DUAL_ENTRY(stub_main)}, /* PJT_MAIN_NP */
102 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_DESTROY */
103 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_INIT */
104 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETTYPE */
105 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_DESTROY */
106 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_INIT */
107 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_LOCK */
108 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_TRYLOCK */
109 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_UNLOCK */
108 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ONCE */
110 {PJT_DUAL_ENTRY(stub_fail)}, /* 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 */

--- 171 unchanged lines hidden (view full) ---

288
289static struct pthread *
290stub_self(void)
291{
292 return (&main_thread);
293}
294
295static int
111 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_DESTROY */
112 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_INIT */
113 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_RDLOCK */
114 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYRDLOCK */
115 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYWRLOCK */
116 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_UNLOCK */
117 {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_WRLOCK */
118 {PJT_DUAL_ENTRY(stub_self)}, /* PJT_SELF */

--- 171 unchanged lines hidden (view full) ---

290
291static struct pthread *
292stub_self(void)
293{
294 return (&main_thread);
295}
296
297static int
298stub_fail(void)
299{
300 return ENOSYS;
301}
302
303static int
296stub_main(void)
297{
298 return (-1);
299}
300
301static int
302stub_true(void)
303{
304 return (1);
305}
306
307static void
308stub_exit(void)
309{
310 exit(0);
311}
304stub_main(void)
305{
306 return (-1);
307}
308
309static int
310stub_true(void)
311{
312 return (1);
313}
314
315static void
316stub_exit(void)
317{
318 exit(0);
319}