undo: don't double free path
[dragonfly.git] / lib / libc / gen / pthread_fake.c
CommitLineData
1303ef3a
JS
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 *
808851ae 34 * $DragonFly: src/lib/libc/gen/pthread_fake.c,v 1.3 2008/05/25 21:34:49 hasso Exp $
1303ef3a
JS
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
a859197e
JS
53int _pthread_fake_inval(void);
54void *_pthread_fake_null(void);
55
808851ae 56__weak_reference(_pthread_fake_inval, pthread_atfork);
1303ef3a
JS
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
159int
160_pthread_fake_inval(void)
161{
162 return EINVAL;
163}
164
165void *
166_pthread_fake_null(void)
167{
168 return NULL;
169}
170
171#endif /* _THREAD_SAFE */