1 /* Copyright (C) 2006 Diego Pettenò
2 * Inspired by libX11 code copyright (c) 1995 David E. Wexelblat.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 * Except as contained in this notice, the names of the authors or their
22 * institutions shall not be used in advertising or otherwise to promote the
23 * sale, use or other dealings in this Software without prior written
24 * authorization from the authors.
31 #ifndef HAVE_PTHREAD_SELF
32 #define NEED_ZERO_STUB
33 # ifdef SUPPORT_ATTRIBUTE_ALIAS
34 int pthread_self() __attribute__ ((weak, alias ("__pthread_zero_stub")));
36 # pragma weak pthread_self = __pthread_zero_stub
40 #ifndef HAVE_PTHREAD_MUTEX_INIT
41 #define NEED_ZERO_STUB
42 # ifdef SUPPORT_ATTRIBUTE_ALIAS
43 int pthread_mutex_init() __attribute__ ((weak, alias ("__pthread_zero_stub")));
45 # pragma weak pthread_mutex_init = __pthread_zero_stub
49 #ifndef HAVE_PTHREAD_MUTEX_DESTROY
50 #define NEED_ZERO_STUB
51 # ifdef SUPPORT_ATTRIBUTE_ALIAS
52 int pthread_mutex_destroy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
54 # pragma weak pthread_mutex_destroy = __pthread_zero_stub
58 #ifndef HAVE_PTHREAD_MUTEX_LOCK
59 #define NEED_ZERO_STUB
60 # ifdef SUPPORT_ATTRIBUTE_ALIAS
61 int pthread_mutex_lock() __attribute__ ((weak, alias ("__pthread_zero_stub")));
63 # pragma weak pthread_mutex_lock = __pthread_zero_stub
67 #ifndef HAVE_PTHREAD_MUTEX_UNLOCK
68 #define NEED_ZERO_STUB
69 # ifdef SUPPORT_ATTRIBUTE_ALIAS
70 int pthread_mutex_unlock() __attribute__ ((weak, alias ("__pthread_zero_stub")));
72 # pragma weak pthread_mutex_unlock = __pthread_zero_stub
76 #ifndef HAVE_PTHREAD_COND_INIT
77 #define NEED_ZERO_STUB
78 # ifdef SUPPORT_ATTRIBUTE_ALIAS
79 int pthread_cond_init() __attribute__ ((weak, alias ("__pthread_zero_stub")));
81 # pragma weak pthread_cond_init = __pthread_zero_stub
85 #ifndef HAVE_PTHREAD_COND_DESTROY
86 #define NEED_ZERO_STUB
87 # ifdef SUPPORT_ATTRIBUTE_ALIAS
88 int pthread_cond_destroy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
90 # pragma weak pthread_cond_destroy = __pthread_zero_stub
94 #ifndef HAVE_PTHREAD_CONDATTR_INIT
95 #define NEED_ZERO_STUB
96 # ifdef SUPPORT_ATTRIBUTE_ALIAS
97 int pthread_condattr_init() __attribute__ ((weak, alias ("__pthread_zero_stub")));
99 # pragma weak pthread_condattr_init = __pthread_zero_stub
103 #ifndef HAVE_PTHREAD_CONDATTR_DESTROY
104 #define NEED_ZERO_STUB
105 # ifdef SUPPORT_ATTRIBUTE_ALIAS
106 int pthread_condattr_destroy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
108 # pragma weak pthread_condattr_destroy = __pthread_zero_stub
112 #ifndef HAVE_PTHREAD_COND_WAIT
113 #define NEED_ABORT_STUB
114 # ifdef SUPPORT_ATTRIBUTE_ALIAS
115 int pthread_cond_wait() __attribute__ ((weak, alias ("__pthread_abort_stub")));
117 # pragma weak pthread_cond_wait = __pthread_abort_stub
121 #ifndef HAVE_PTHREAD_COND_TIMEDWAIT
122 #define NEED_ABORT_STUB
123 # ifdef SUPPORT_ATTRIBUTE_ALIAS
124 int pthread_cond_timedwait() __attribute__ ((weak, alias ("__pthread_abort_stub")));
126 # pragma weak pthread_cond_timedwait = __pthread_abort_stub
130 #ifndef HAVE_PTHREAD_COND_SIGNAL
131 #define NEED_ZERO_STUB
132 # ifdef SUPPORT_ATTRIBUTE_ALIAS
133 int pthread_cond_signal() __attribute__ ((weak, alias ("__pthread_zero_stub")));
135 # pragma weak pthread_cond_signal = __pthread_zero_stub
139 #ifndef HAVE_PTHREAD_COND_BROADCAST
140 #define NEED_ZERO_STUB
141 # ifdef SUPPORT_ATTRIBUTE_ALIAS
142 int pthread_cond_broadcast() __attribute__ ((weak, alias ("__pthread_zero_stub")));
144 # pragma weak pthread_cond_broadcast = __pthread_zero_stub
148 #ifndef HAVE_PTHREAD_EQUAL
149 #define NEED_EQUAL_STUB
150 # ifdef SUPPORT_ATTRIBUTE_ALIAS
151 int pthread_equal() __attribute__ ((weak, alias ("__pthread_equal_stub")));
153 # pragma weak pthread_equal = __pthread_equal_stub
157 #ifndef HAVE_PTHREAD_EXIT
158 #define NEED_EXIT_STUB
159 # ifdef SUPPORT_ATTRIBUTE_ALIAS
160 int pthread_exit() __attribute__ ((weak, alias ("__pthread_exit_stub")));
162 # pragma weak pthread_exit = __pthread_exit_stub
166 #ifdef NEED_ZERO_STUB
167 static int __pthread_zero_stub()
173 #ifdef NEED_ABORT_STUB
174 static int __pthread_abort_stub()
180 #ifdef NEED_EQUAL_STUB
181 static int __pthread_equal_stub(pthread_t t1, pthread_t t2)
187 #ifdef NEED_EXIT_STUB
188 static void __pthread_exit_stub(void *ret)