xref: /dflybsd-src/lib/libc/gen/_pthread_stubs.c (revision 17ea22213f86a5c5966c1e6bf8e95f022ebb92b9)
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
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS''
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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  * $FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/_pthread_stubs.c,v 1.1 2001/01/24 12:59:20 deischen Exp $
27  * $DragonFly: src/lib/libc/gen/_pthread_stubs.c,v 1.1 2005/01/31 22:29:15 dillon Exp $
28  */
29 
30 #include <pthread.h>
31 
32 /*
33  * Weak symbols: All libc internal usage of these functions should
34  * use the weak symbol versions (_pthread_XXX).  If libpthread is
35  * linked, it will override these functions with (non-weak) routines.
36  * The _pthread_XXX functions are provided solely for internal libc
37  * usage to avoid unwanted cancellation points and to differentiate
38  * between application locks and libc locks (threads holding the
39  * latter can't be allowed to exit/terminate).
40  */
41 #pragma weak	_pthread_getspecific=_pthread_getspecific_stub
42 #pragma weak	_pthread_key_create=_pthread_key_create_stub
43 #pragma weak	_pthread_key_delete=_pthread_key_delete_stub
44 #pragma weak	_pthread_mutex_destroy=_pthread_mutex_destroy_stub
45 #pragma weak	_pthread_mutex_init=_pthread_mutex_init_stub
46 #pragma weak	_pthread_mutex_lock=_pthread_mutex_lock_stub
47 #pragma weak	_pthread_mutex_trylock=_pthread_mutex_trylock_stub
48 #pragma weak	_pthread_mutex_unlock=_pthread_mutex_unlock_stub
49 #pragma weak	_pthread_mutexattr_init=_pthread_mutexattr_init_stub
50 #pragma weak	_pthread_mutexattr_destroy=_pthread_mutexattr_destroy_stub
51 #pragma weak	_pthread_mutexattr_settype=_pthread_mutexattr_settype_stub
52 #pragma weak	_pthread_once=_pthread_once_stub
53 #pragma weak	_pthread_setspecific=_pthread_setspecific_stub
54 
55 
56 void *
57 _pthread_getspecific_stub(pthread_key_t key)
58 {
59 	return (NULL);
60 }
61 
62 int
63 _pthread_key_create_stub(pthread_key_t *key, void (*destructor) (void *))
64 {
65 	return (0);
66 }
67 
68 int
69 _pthread_key_delete_stub(pthread_key_t key)
70 {
71 	return (0);
72 }
73 
74 int
75 _pthread_mutex_destroy_stub(pthread_mutex_t *mattr)
76 {
77 	return (0);
78 }
79 
80 int
81 _pthread_mutex_init_stub(pthread_mutex_t *mutex, const pthread_mutexattr_t *mattr)
82 {
83 	return (0);
84 }
85 
86 int
87 _pthread_mutex_lock_stub(pthread_mutex_t *mutex)
88 {
89 	return (0);
90 }
91 
92 int
93 _pthread_mutex_trylock_stub(pthread_mutex_t *mutex)
94 {
95 	return (0);
96 }
97 
98 int
99 _pthread_mutex_unlock_stub(pthread_mutex_t *mutex)
100 {
101 	return (0);
102 }
103 
104 int
105 _pthread_mutexattr_init_stub(pthread_mutexattr_t *mattr)
106 {
107 	return (0);
108 }
109 
110 int
111 _pthread_mutexattr_destroy_stub(pthread_mutexattr_t *mattr)
112 {
113 	return (0);
114 }
115 
116 int
117 _pthread_mutexattr_settype_stub(pthread_mutexattr_t *mattr, int type)
118 {
119 	return (0);
120 }
121 
122 int
123 _pthread_once_stub(pthread_once_t *once_control, void (*init_routine) (void))
124 {
125 	return (0);
126 }
127 
128 int
129 _pthread_setspecific_stub(pthread_key_t key, const void *value)
130 {
131 	return (0);
132 }
133 
134