7b28929f8bdeea6bf7228e7c2f4f8207c75f4d36
[dragonfly.git] / lib / libc / gen / pthread_fake.c
1 /*
2  * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
3  * 
4  * This code is derived from software contributed to The DragonFly Project
5  * by Simon Schubert <corecode@fs.ei.tum.de>
6  * 
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  * 3. Neither the name of The DragonFly Project nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific, prior written permission.
20  * 
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  * 
34  * $DragonFly: src/lib/libc/gen/pthread_fake.c,v 1.3 2008/05/25 21:34:49 hasso Exp $
35  */
36
37 #ifndef _THREAD_SAFE
38 /*
39  * Provide the functions for non-threaded programs using
40  * thread-aware dynamic modules.
41  *
42  * This list explicitly lakes pthread_create, since an application
43  * using this function clearly should be linked against -lc_r.
44  * Leaving this function out allows the linker to catch this.
45  * Same reason applies for thread-aware modules.
46  */
47
48 #include <sys/cdefs.h>
49
50 #include <errno.h>
51 #include <stddef.h>
52
53 int      _pthread_fake_inval(void);
54 void    *_pthread_fake_null(void);
55
56 __weak_reference(_pthread_fake_inval, pthread_atfork);
57 __weak_reference(_pthread_fake_inval, pthread_attr_destroy);
58 __weak_reference(_pthread_fake_inval, pthread_attr_get_np);
59 __weak_reference(_pthread_fake_inval, pthread_attr_getdetachstate);
60 __weak_reference(_pthread_fake_inval, pthread_attr_getinheritsched);
61 __weak_reference(_pthread_fake_inval, pthread_attr_getschedparam);
62 __weak_reference(_pthread_fake_inval, pthread_attr_getschedpolicy);
63 __weak_reference(_pthread_fake_inval, pthread_attr_getscope);
64 __weak_reference(_pthread_fake_inval, pthread_attr_getstack);
65 __weak_reference(_pthread_fake_inval, pthread_attr_getstackaddr);
66 __weak_reference(_pthread_fake_inval, pthread_attr_getstacksize);
67 __weak_reference(_pthread_fake_inval, pthread_attr_init);
68 __weak_reference(_pthread_fake_inval, pthread_attr_setcreatesuspend_np);
69 __weak_reference(_pthread_fake_inval, pthread_attr_setdetachstate);
70 __weak_reference(_pthread_fake_inval, pthread_attr_setinheritsched);
71 __weak_reference(_pthread_fake_inval, pthread_attr_setschedparam);
72 __weak_reference(_pthread_fake_inval, pthread_attr_setschedpolicy);
73 __weak_reference(_pthread_fake_inval, pthread_attr_setscope);
74 __weak_reference(_pthread_fake_inval, pthread_attr_setstack);
75 __weak_reference(_pthread_fake_inval, pthread_attr_setstackaddr);
76 __weak_reference(_pthread_fake_inval, pthread_attr_setstacksize);
77 __weak_reference(_pthread_fake_inval, pthread_cancel);
78 __weak_reference(_pthread_fake_inval, pthread_setcancelstate);
79 __weak_reference(_pthread_fake_inval, pthread_setcanceltype);
80 __weak_reference(_pthread_fake_inval, pthread_testcancel);/*XXX void */
81 __weak_reference(_pthread_fake_inval, pthread_cleanup_push);/*XXX void */
82 __weak_reference(_pthread_fake_inval, pthread_cleanup_pop);/*XXX void */
83 __weak_reference(_pthread_fake_inval, pthread_getconcurrency);
84 __weak_reference(_pthread_fake_inval, pthread_setconcurrency);
85 __weak_reference(_pthread_fake_inval, pthread_cond_init);
86 __weak_reference(_pthread_fake_inval, pthread_cond_destroy);
87 __weak_reference(_pthread_fake_inval, pthread_cond_wait);
88 __weak_reference(_pthread_fake_inval, pthread_cond_timedwait);
89 __weak_reference(_pthread_fake_inval, pthread_cond_signal);
90 __weak_reference(_pthread_fake_inval, pthread_cond_broadcast);
91 __weak_reference(_pthread_fake_inval, pthread_condattr_destroy);
92 __weak_reference(_pthread_fake_inval, pthread_condattr_init);
93 __weak_reference(_pthread_fake_inval, pthread_detach);
94 __weak_reference(_pthread_fake_inval, pthread_equal);/*XXX*/
95 __weak_reference(_pthread_fake_inval, pthread_exit);/*XXX void*/
96 __weak_reference(_pthread_fake_inval, pthread_getprio);
97 __weak_reference(_pthread_fake_inval, pthread_getschedparam);
98 __weak_reference(_pthread_fake_inval, pthread_set_name_np);/*XXX void*/
99 __weak_reference(_pthread_fake_inval, pthread_join);
100 __weak_reference(_pthread_fake_inval, pthread_kill);
101 __weak_reference(_pthread_fake_inval, pthread_main_np);
102 __weak_reference(_pthread_fake_inval, pthread_mutexattr_init);
103 __weak_reference(_pthread_fake_inval, pthread_mutexattr_setkind_np);
104 __weak_reference(_pthread_fake_inval, pthread_mutexattr_getkind_np);
105 __weak_reference(_pthread_fake_inval, pthread_mutexattr_gettype);
106 __weak_reference(_pthread_fake_inval, pthread_mutexattr_settype);
107 __weak_reference(_pthread_fake_inval, pthread_multi_np);
108 __weak_reference(_pthread_fake_inval, pthread_mutex_init);
109 __weak_reference(_pthread_fake_inval, pthread_mutex_destroy);
110 __weak_reference(_pthread_fake_inval, pthread_mutex_trylock);
111 __weak_reference(_pthread_fake_inval, pthread_mutex_lock);
112 __weak_reference(_pthread_fake_inval, pthread_mutex_unlock);
113 __weak_reference(_pthread_fake_inval, pthread_mutexattr_getprioceiling);
114 __weak_reference(_pthread_fake_inval, pthread_mutexattr_setprioceiling);
115 __weak_reference(_pthread_fake_inval, pthread_mutex_getprioceiling);
116 __weak_reference(_pthread_fake_inval, pthread_mutex_setprioceiling);
117 __weak_reference(_pthread_fake_inval, pthread_mutexattr_getprotocol);
118 __weak_reference(_pthread_fake_inval, pthread_mutexattr_setprotocol);
119 __weak_reference(_pthread_fake_inval, pthread_mutexattr_destroy);
120 __weak_reference(_pthread_fake_inval, pthread_once);
121 __weak_reference(_pthread_fake_inval, pthread_resume_np);
122 __weak_reference(_pthread_fake_inval, pthread_resume_all_np);/*XXX void*/
123 __weak_reference(_pthread_fake_inval, pthread_rwlock_destroy);
124 __weak_reference(_pthread_fake_inval, pthread_rwlock_init);
125 __weak_reference(_pthread_fake_inval, pthread_rwlock_rdlock);
126 __weak_reference(_pthread_fake_inval, pthread_rwlock_tryrdlock);
127 __weak_reference(_pthread_fake_inval, pthread_rwlock_trywrlock);
128 __weak_reference(_pthread_fake_inval, pthread_rwlock_unlock);
129 __weak_reference(_pthread_fake_inval, pthread_rwlock_wrlock);
130 __weak_reference(_pthread_fake_inval, pthread_rwlockattr_destroy);
131 __weak_reference(_pthread_fake_inval, pthread_rwlockattr_getpshared);
132 __weak_reference(_pthread_fake_inval, pthread_rwlockattr_init);
133 __weak_reference(_pthread_fake_inval, pthread_rwlockattr_setpshared);
134 __weak_reference(_pthread_fake_null, pthread_self);/*XXX pthread_t */
135 __weak_reference(_pthread_fake_inval, sem_init);
136 __weak_reference(_pthread_fake_inval, sem_destroy);
137 __weak_reference(_pthread_fake_inval, sem_open);
138 __weak_reference(_pthread_fake_inval, sem_close);
139 __weak_reference(_pthread_fake_inval, sem_unlink);
140 __weak_reference(_pthread_fake_inval, sem_wait);
141 __weak_reference(_pthread_fake_inval, sem_trywait);
142 __weak_reference(_pthread_fake_inval, sem_post);
143 __weak_reference(_pthread_fake_inval, sem_getvalue);
144 __weak_reference(_pthread_fake_inval, pthread_setprio);
145 __weak_reference(_pthread_fake_inval, pthread_setschedparam);
146 __weak_reference(_pthread_fake_inval, pthread_sigmask);
147 __weak_reference(_pthread_fake_inval, pthread_single_np);
148 __weak_reference(_pthread_fake_inval, pthread_key_create);
149 __weak_reference(_pthread_fake_inval, pthread_key_delete);
150 __weak_reference(_pthread_fake_inval, pthread_getspecific);
151 __weak_reference(_pthread_fake_inval, pthread_setspecific);
152 __weak_reference(_pthread_fake_inval, pthread_suspend_np);
153 __weak_reference(_pthread_fake_inval, pthread_suspend_all_np);/*XXX void*/
154 __weak_reference(_pthread_fake_inval, pthread_switch_add_np);
155 __weak_reference(_pthread_fake_inval, pthread_switch_delete_np);
156 __weak_reference(_pthread_fake_inval, sched_yield);
157 __weak_reference(_pthread_fake_inval, pthread_yield);/*XXX void*/
158
159 int
160 _pthread_fake_inval(void)
161 {
162         return EINVAL;
163 }
164
165 void *
166 _pthread_fake_null(void)
167 {
168         return NULL;
169 }
170
171 #endif /* _THREAD_SAFE */