xref: /minix3/lib/libc/include/reentrant.h (revision 180e74704d3b012a5a9186f196cd218b8ab783f4)
10a6a1f1dSLionel Sambuc /*	$NetBSD: reentrant.h,v 1.18 2015/01/20 18:31:25 christos Exp $	*/
22fe8fb19SBen Gras 
32fe8fb19SBen Gras /*-
42fe8fb19SBen Gras  * Copyright (c) 1997, 1998, 2003 The NetBSD Foundation, Inc.
52fe8fb19SBen Gras  * All rights reserved.
62fe8fb19SBen Gras  *
72fe8fb19SBen Gras  * This code is derived from software contributed to The NetBSD Foundation
82fe8fb19SBen Gras  * by J.T. Conklin, by Nathan J. Williams, and by Jason R. Thorpe.
92fe8fb19SBen Gras  *
102fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
112fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
122fe8fb19SBen Gras  * are met:
132fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
142fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
152fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
162fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
172fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
182fe8fb19SBen Gras  *
192fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
202fe8fb19SBen Gras  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
212fe8fb19SBen Gras  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
222fe8fb19SBen Gras  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
232fe8fb19SBen Gras  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
242fe8fb19SBen Gras  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
252fe8fb19SBen Gras  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
262fe8fb19SBen Gras  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
272fe8fb19SBen Gras  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
282fe8fb19SBen Gras  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
292fe8fb19SBen Gras  * POSSIBILITY OF SUCH DAMAGE.
302fe8fb19SBen Gras  */
312fe8fb19SBen Gras 
322fe8fb19SBen Gras /*
332fe8fb19SBen Gras  * Requirements:
342fe8fb19SBen Gras  *
352fe8fb19SBen Gras  * 1. The thread safe mechanism should be lightweight so the library can
362fe8fb19SBen Gras  *    be used by non-threaded applications without unreasonable overhead.
372fe8fb19SBen Gras  *
382fe8fb19SBen Gras  * 2. There should be no dependency on a thread engine for non-threaded
392fe8fb19SBen Gras  *    applications.
402fe8fb19SBen Gras  *
412fe8fb19SBen Gras  * 3. There should be no dependency on any particular thread engine.
422fe8fb19SBen Gras  *
432fe8fb19SBen Gras  * 4. The library should be able to be compiled without support for thread
442fe8fb19SBen Gras  *    safety.
452fe8fb19SBen Gras  *
462fe8fb19SBen Gras  *
472fe8fb19SBen Gras  * Rationale:
482fe8fb19SBen Gras  *
492fe8fb19SBen Gras  * One approach for thread safety is to provide discrete versions of the
502fe8fb19SBen Gras  * library: one thread safe, the other not.  The disadvantage of this is
512fe8fb19SBen Gras  * that libc is rather large, and two copies of a library which are 99%+
522fe8fb19SBen Gras  * identical is not an efficent use of resources.
532fe8fb19SBen Gras  *
542fe8fb19SBen Gras  * Another approach is to provide a single thread safe library.  However,
552fe8fb19SBen Gras  * it should not add significant run time or code size overhead to non-
562fe8fb19SBen Gras  * threaded applications.
572fe8fb19SBen Gras  *
582fe8fb19SBen Gras  * Since the NetBSD C library is used in other projects, it should be
592fe8fb19SBen Gras  * easy to replace the mutual exclusion primitives with ones provided by
602fe8fb19SBen Gras  * another system.  Similarly, it should also be easy to remove all
612fe8fb19SBen Gras  * support for thread safety completely if the target environment does
622fe8fb19SBen Gras  * not support threads.
632fe8fb19SBen Gras  *
642fe8fb19SBen Gras  *
652fe8fb19SBen Gras  * Implementation Details:
662fe8fb19SBen Gras  *
672fe8fb19SBen Gras  * The thread primitives used by the library (mutex_t, mutex_lock, etc.)
682fe8fb19SBen Gras  * are macros which expand to the cooresponding primitives provided by
692fe8fb19SBen Gras  * the thread engine or to nothing.  The latter is used so that code is
702fe8fb19SBen Gras  * not unreasonably cluttered with #ifdefs when all thread safe support
712fe8fb19SBen Gras  * is removed.
722fe8fb19SBen Gras  *
732fe8fb19SBen Gras  * The thread macros can be directly mapped to the mutex primitives from
742fe8fb19SBen Gras  * pthreads, however it should be reasonably easy to wrap another mutex
752fe8fb19SBen Gras  * implementation so it presents a similar interface.
762fe8fb19SBen Gras  *
772fe8fb19SBen Gras  * The thread functions operate by dispatching to symbols which are, by
782fe8fb19SBen Gras  * default, weak-aliased to no-op functions in thread-stub/thread-stub.c
792fe8fb19SBen Gras  * (some uses of thread operations are conditional on __isthreaded, but
802fe8fb19SBen Gras  * not all of them are).
812fe8fb19SBen Gras  *
822fe8fb19SBen Gras  * When the thread library is linked in, it provides strong-alias versions
832fe8fb19SBen Gras  * of those symbols which dispatch to its own real thread operations.
842fe8fb19SBen Gras  *
852fe8fb19SBen Gras  */
862fe8fb19SBen Gras 
87*180e7470SDavid van Moolenbroek #if !defined(__minix) || !defined(_LIBC_REENTRANT_H)
88*180e7470SDavid van Moolenbroek #ifdef __minix
89*180e7470SDavid van Moolenbroek /*
90*180e7470SDavid van Moolenbroek  * If _REENTRANT is not defined, the header may not be included more than once.
91*180e7470SDavid van Moolenbroek  * This is probably a NetBSD libc bug, but for now we solve it for MINIX3 only.
92*180e7470SDavid van Moolenbroek  */
93*180e7470SDavid van Moolenbroek #define _LIBC_REENTRANT_H
94*180e7470SDavid van Moolenbroek #endif /* __minix */
952fe8fb19SBen Gras 
962fe8fb19SBen Gras /*
972fe8fb19SBen Gras  * Abstract thread interface for thread-safe libraries.  These routines
982fe8fb19SBen Gras  * will use stubs in libc if the application is not linked against the
992fe8fb19SBen Gras  * pthread library, and the real function in the pthread library if it
1002fe8fb19SBen Gras  * is.
1012fe8fb19SBen Gras  */
1022fe8fb19SBen Gras 
103*180e7470SDavid van Moolenbroek #ifndef __minix
104*180e7470SDavid van Moolenbroek 
1052fe8fb19SBen Gras #include <pthread.h>
1062fe8fb19SBen Gras #include <signal.h>
1072fe8fb19SBen Gras 
1082fe8fb19SBen Gras #define	mutex_t			pthread_mutex_t
1092fe8fb19SBen Gras #define	MUTEX_INITIALIZER	PTHREAD_MUTEX_INITIALIZER
1102fe8fb19SBen Gras 
1112fe8fb19SBen Gras #define	mutexattr_t		pthread_mutexattr_t
1122fe8fb19SBen Gras 
1132fe8fb19SBen Gras #define	MUTEX_TYPE_NORMAL	PTHREAD_MUTEX_NORMAL
1142fe8fb19SBen Gras #define	MUTEX_TYPE_ERRORCHECK	PTHREAD_MUTEX_ERRORCHECK
1152fe8fb19SBen Gras #define	MUTEX_TYPE_RECURSIVE	PTHREAD_MUTEX_RECURSIVE
1162fe8fb19SBen Gras 
1172fe8fb19SBen Gras #define	cond_t			pthread_cond_t
1182fe8fb19SBen Gras #define	COND_INITIALIZER	PTHREAD_COND_INITIALIZER
1192fe8fb19SBen Gras 
1202fe8fb19SBen Gras #define	condattr_t		pthread_condattr_t
1212fe8fb19SBen Gras 
1222fe8fb19SBen Gras #define	rwlock_t		pthread_rwlock_t
1232fe8fb19SBen Gras #define	RWLOCK_INITIALIZER	PTHREAD_RWLOCK_INITIALIZER
1242fe8fb19SBen Gras 
1252fe8fb19SBen Gras #define	rwlockattr_t		pthread_rwlockattr_t
1262fe8fb19SBen Gras 
1272fe8fb19SBen Gras #define	thread_key_t		pthread_key_t
1282fe8fb19SBen Gras 
1292fe8fb19SBen Gras #define	thr_t			pthread_t
1302fe8fb19SBen Gras 
1312fe8fb19SBen Gras #define	thrattr_t		pthread_attr_t
1322fe8fb19SBen Gras 
1332fe8fb19SBen Gras #define	once_t			pthread_once_t
1342fe8fb19SBen Gras #define	ONCE_INITIALIZER	PTHREAD_ONCE_INIT
1352fe8fb19SBen Gras 
136*180e7470SDavid van Moolenbroek #else /* __minix */
137*180e7470SDavid van Moolenbroek 
138*180e7470SDavid van Moolenbroek typedef struct {
139*180e7470SDavid van Moolenbroek 	int pto_done;
140*180e7470SDavid van Moolenbroek } once_t;
141*180e7470SDavid van Moolenbroek #define ONCE_INITIALIZER	{ .pto_done = 0 }
142*180e7470SDavid van Moolenbroek 
143*180e7470SDavid van Moolenbroek #endif /* __minix */
144*180e7470SDavid van Moolenbroek 
145*180e7470SDavid van Moolenbroek #ifdef _REENTRANT
146*180e7470SDavid van Moolenbroek 
1472fe8fb19SBen Gras #ifndef __LIBC_THREAD_STUBS
1482fe8fb19SBen Gras 
1492fe8fb19SBen Gras __BEGIN_DECLS
1502fe8fb19SBen Gras int	__libc_mutex_init(mutex_t *, const mutexattr_t *);
1512fe8fb19SBen Gras int	__libc_mutex_lock(mutex_t *);
1522fe8fb19SBen Gras int	__libc_mutex_trylock(mutex_t *);
1532fe8fb19SBen Gras int	__libc_mutex_unlock(mutex_t *);
1542fe8fb19SBen Gras int	__libc_mutex_destroy(mutex_t *);
1552fe8fb19SBen Gras 
1562fe8fb19SBen Gras int	__libc_mutexattr_init(mutexattr_t *);
1572fe8fb19SBen Gras int	__libc_mutexattr_settype(mutexattr_t *, int);
1582fe8fb19SBen Gras int	__libc_mutexattr_destroy(mutexattr_t *);
1592fe8fb19SBen Gras __END_DECLS
1602fe8fb19SBen Gras 
1612fe8fb19SBen Gras #define	mutex_init(m, a)	__libc_mutex_init((m), (a))
1622fe8fb19SBen Gras #define	mutex_lock(m)		__libc_mutex_lock((m))
1632fe8fb19SBen Gras #define	mutex_trylock(m)	__libc_mutex_trylock((m))
1642fe8fb19SBen Gras #define	mutex_unlock(m)		__libc_mutex_unlock((m))
1652fe8fb19SBen Gras #define	mutex_destroy(m)	__libc_mutex_destroy((m))
1662fe8fb19SBen Gras 
1672fe8fb19SBen Gras #define	mutexattr_init(ma)	__libc_mutexattr_init((ma))
1682fe8fb19SBen Gras #define	mutexattr_settype(ma, t) __libc_mutexattr_settype((ma), (t))
1692fe8fb19SBen Gras #define	mutexattr_destroy(ma)	__libc_mutexattr_destroy((ma))
1702fe8fb19SBen Gras 
1712fe8fb19SBen Gras __BEGIN_DECLS
1722fe8fb19SBen Gras int	__libc_cond_init(cond_t *, const condattr_t *);
1732fe8fb19SBen Gras int	__libc_cond_signal(cond_t *);
1742fe8fb19SBen Gras int	__libc_cond_broadcast(cond_t *);
1752fe8fb19SBen Gras int	__libc_cond_wait(cond_t *, mutex_t *);
1762fe8fb19SBen Gras #ifndef __LIBC12_SOURCE__
1772fe8fb19SBen Gras int	__libc_cond_timedwait(cond_t *, mutex_t *, const struct timespec *);
1782fe8fb19SBen Gras #endif
1792fe8fb19SBen Gras int	__libc_cond_destroy(cond_t *);
1802fe8fb19SBen Gras __END_DECLS
1812fe8fb19SBen Gras 
1822fe8fb19SBen Gras #define	cond_init(c, t, a)     	__libc_cond_init((c), (a))
1832fe8fb19SBen Gras #define	cond_signal(c)		__libc_cond_signal((c))
1842fe8fb19SBen Gras #define	cond_broadcast(c)	__libc_cond_broadcast((c))
1852fe8fb19SBen Gras #define	cond_wait(c, m)		__libc_cond_wait((c), (m))
1862fe8fb19SBen Gras #define	cond_timedwait(c, m, t)	__libc_cond_timedwait((c), (m), (t))
1872fe8fb19SBen Gras #define	cond_destroy(c)		__libc_cond_destroy((c))
1882fe8fb19SBen Gras 
1892fe8fb19SBen Gras __BEGIN_DECLS
1902fe8fb19SBen Gras int	__libc_rwlock_init(rwlock_t *, const rwlockattr_t *);
1912fe8fb19SBen Gras int	__libc_rwlock_rdlock(rwlock_t *);
1922fe8fb19SBen Gras int	__libc_rwlock_wrlock(rwlock_t *);
1932fe8fb19SBen Gras int	__libc_rwlock_tryrdlock(rwlock_t *);
1942fe8fb19SBen Gras int	__libc_rwlock_trywrlock(rwlock_t *);
1952fe8fb19SBen Gras int	__libc_rwlock_unlock(rwlock_t *);
1962fe8fb19SBen Gras int	__libc_rwlock_destroy(rwlock_t *);
1972fe8fb19SBen Gras __END_DECLS
1982fe8fb19SBen Gras 
1992fe8fb19SBen Gras #define	rwlock_init(l, a)	__libc_rwlock_init((l), (a))
2002fe8fb19SBen Gras #define	rwlock_rdlock(l)	__libc_rwlock_rdlock((l))
2012fe8fb19SBen Gras #define	rwlock_wrlock(l)	__libc_rwlock_wrlock((l))
2022fe8fb19SBen Gras #define	rwlock_tryrdlock(l)	__libc_rwlock_tryrdlock((l))
2032fe8fb19SBen Gras #define	rwlock_trywrlock(l)	__libc_rwlock_trywrlock((l))
2042fe8fb19SBen Gras #define	rwlock_unlock(l)	__libc_rwlock_unlock((l))
2052fe8fb19SBen Gras #define	rwlock_destroy(l)	__libc_rwlock_destroy((l))
2062fe8fb19SBen Gras 
2072fe8fb19SBen Gras __BEGIN_DECLS
2082fe8fb19SBen Gras int	__libc_thr_keycreate(thread_key_t *, void (*)(void *));
2092fe8fb19SBen Gras int	__libc_thr_setspecific(thread_key_t, const void *);
2102fe8fb19SBen Gras void	*__libc_thr_getspecific(thread_key_t);
2112fe8fb19SBen Gras int	__libc_thr_keydelete(thread_key_t);
2122fe8fb19SBen Gras __END_DECLS
2132fe8fb19SBen Gras 
2142fe8fb19SBen Gras #define	thr_keycreate(k, d)	__libc_thr_keycreate((k), (d))
2152fe8fb19SBen Gras #define	thr_setspecific(k, p)	__libc_thr_setspecific((k), (p))
2162fe8fb19SBen Gras #define	thr_getspecific(k)	__libc_thr_getspecific((k))
2172fe8fb19SBen Gras #define	thr_keydelete(k)	__libc_thr_keydelete((k))
2182fe8fb19SBen Gras 
2192fe8fb19SBen Gras __BEGIN_DECLS
2202fe8fb19SBen Gras int	__libc_thr_once(once_t *, void (*)(void));
2212fe8fb19SBen Gras int	__libc_thr_sigsetmask(int, const sigset_t *, sigset_t *);
2222fe8fb19SBen Gras thr_t	__libc_thr_self(void);
2232fe8fb19SBen Gras int	__libc_thr_yield(void);
2242fe8fb19SBen Gras void	__libc_thr_create(thr_t *, const thrattr_t *,
2252fe8fb19SBen Gras 	    void *(*)(void *), void *);
2262fe8fb19SBen Gras void	__libc_thr_exit(void *) __attribute__((__noreturn__));
2272fe8fb19SBen Gras int	*__libc_thr_errno(void);
2282fe8fb19SBen Gras int	__libc_thr_setcancelstate(int, int *);
2292fe8fb19SBen Gras unsigned int	__libc_thr_curcpu(void);
2302fe8fb19SBen Gras 
2312fe8fb19SBen Gras extern int __isthreaded;
2322fe8fb19SBen Gras __END_DECLS
2332fe8fb19SBen Gras 
2342fe8fb19SBen Gras #define	thr_once(o, f)		__libc_thr_once((o), (f))
2352fe8fb19SBen Gras #define	thr_sigsetmask(f, n, o)	__libc_thr_sigsetmask((f), (n), (o))
2362fe8fb19SBen Gras #define	thr_self()		__libc_thr_self()
2372fe8fb19SBen Gras #define	thr_yield()		__libc_thr_yield()
2382fe8fb19SBen Gras #define	thr_create(tp, ta, f, a) __libc_thr_create((tp), (ta), (f), (a))
2392fe8fb19SBen Gras #define	thr_exit(v)		__libc_thr_exit((v))
2402fe8fb19SBen Gras #define	thr_errno()		__libc_thr_errno()
2412fe8fb19SBen Gras #define	thr_enabled()		(__isthreaded)
2422fe8fb19SBen Gras #define thr_setcancelstate(n, o) __libc_thr_setcancelstate((n),(o))
2432fe8fb19SBen Gras #define thr_curcpu()		__libc_thr_curcpu()
24484d9c625SLionel Sambuc 
24584d9c625SLionel Sambuc #else /* __LIBC_THREAD_STUBS */
24684d9c625SLionel Sambuc 
24784d9c625SLionel Sambuc __BEGIN_DECLS
24884d9c625SLionel Sambuc void	__libc_thr_init_stub(void);
24984d9c625SLionel Sambuc 
25084d9c625SLionel Sambuc int	__libc_mutex_init_stub(mutex_t *, const mutexattr_t *);
25184d9c625SLionel Sambuc int	__libc_mutex_lock_stub(mutex_t *);
25284d9c625SLionel Sambuc int	__libc_mutex_trylock_stub(mutex_t *);
25384d9c625SLionel Sambuc int	__libc_mutex_unlock_stub(mutex_t *);
25484d9c625SLionel Sambuc int	__libc_mutex_destroy_stub(mutex_t *);
25584d9c625SLionel Sambuc 
25684d9c625SLionel Sambuc int	__libc_mutexattr_init_stub(mutexattr_t *);
25784d9c625SLionel Sambuc int	__libc_mutexattr_destroy_stub(mutexattr_t *);
25884d9c625SLionel Sambuc int	__libc_mutexattr_settype_stub(mutexattr_t *, int);
25984d9c625SLionel Sambuc 
26084d9c625SLionel Sambuc int	__libc_cond_init_stub(cond_t *, const condattr_t *);
26184d9c625SLionel Sambuc int	__libc_cond_signal_stub(cond_t *);
26284d9c625SLionel Sambuc int	__libc_cond_broadcast_stub(cond_t *);
26384d9c625SLionel Sambuc int	__libc_cond_wait_stub(cond_t *, mutex_t *);
26484d9c625SLionel Sambuc int	__libc_cond_timedwait_stub(cond_t *, mutex_t *,
26584d9c625SLionel Sambuc 				   const struct timespec *);
26684d9c625SLionel Sambuc int	__libc_cond_destroy_stub(cond_t *);
26784d9c625SLionel Sambuc 
26884d9c625SLionel Sambuc int	__libc_rwlock_init_stub(rwlock_t *, const rwlockattr_t *);
26984d9c625SLionel Sambuc int	__libc_rwlock_rdlock_stub(rwlock_t *);
27084d9c625SLionel Sambuc int	__libc_rwlock_wrlock_stub(rwlock_t *);
27184d9c625SLionel Sambuc int	__libc_rwlock_tryrdlock_stub(rwlock_t *);
27284d9c625SLionel Sambuc int	__libc_rwlock_trywrlock_stub(rwlock_t *);
27384d9c625SLionel Sambuc int	__libc_rwlock_unlock_stub(rwlock_t *);
27484d9c625SLionel Sambuc int	__libc_rwlock_destroy_stub(rwlock_t *);
27584d9c625SLionel Sambuc 
27684d9c625SLionel Sambuc int	__libc_thr_keycreate_stub(thread_key_t *, void (*)(void *));
27784d9c625SLionel Sambuc int	__libc_thr_setspecific_stub(thread_key_t, const void *);
27884d9c625SLionel Sambuc void	*__libc_thr_getspecific_stub(thread_key_t);
27984d9c625SLionel Sambuc int	__libc_thr_keydelete_stub(thread_key_t);
28084d9c625SLionel Sambuc 
28184d9c625SLionel Sambuc int	__libc_thr_once_stub(once_t *, void (*)(void));
28284d9c625SLionel Sambuc int	__libc_thr_sigsetmask_stub(int, const sigset_t *, sigset_t *);
28384d9c625SLionel Sambuc thr_t	__libc_thr_self_stub(void);
28484d9c625SLionel Sambuc int	__libc_thr_yield_stub(void);
28584d9c625SLionel Sambuc int	__libc_thr_create_stub(thr_t *, const thrattr_t *,
28684d9c625SLionel Sambuc 	    void *(*)(void *), void *);
28784d9c625SLionel Sambuc void	__libc_thr_exit_stub(void *) __dead;
28884d9c625SLionel Sambuc int	*__libc_thr_errno_stub(void);
28984d9c625SLionel Sambuc int	__libc_thr_setcancelstate_stub(int, int *);
29084d9c625SLionel Sambuc int	__libc_thr_equal_stub(pthread_t, pthread_t);
29184d9c625SLionel Sambuc unsigned int	__libc_thr_curcpu_stub(void);
29284d9c625SLionel Sambuc __END_DECLS
29384d9c625SLionel Sambuc 
2942fe8fb19SBen Gras #endif /* __LIBC_THREAD_STUBS */
2952fe8fb19SBen Gras 
2962fe8fb19SBen Gras #define	FLOCKFILE(fp)		__flockfile_internal(fp, 1)
2972fe8fb19SBen Gras #define	FUNLOCKFILE(fp)		__funlockfile_internal(fp, 1)
2982fe8fb19SBen Gras 
2992fe8fb19SBen Gras #else /* _REENTRANT */
3002fe8fb19SBen Gras 
3010a6a1f1dSLionel Sambuc #ifndef __empty
3020a6a1f1dSLionel Sambuc #define __empty do {} while (/*CONSTCOND*/0)
3030a6a1f1dSLionel Sambuc #endif
3040a6a1f1dSLionel Sambuc #define	mutex_init(m, a) __empty
3050a6a1f1dSLionel Sambuc #define	mutex_lock(m) __empty
3060a6a1f1dSLionel Sambuc #define	mutex_trylock(m) __empty
3070a6a1f1dSLionel Sambuc #define	mutex_unlock(m)	__empty
3080a6a1f1dSLionel Sambuc #define	mutex_destroy(m) __empty
3092fe8fb19SBen Gras 
3100a6a1f1dSLionel Sambuc #define	cond_init(c, t, a) __empty
3110a6a1f1dSLionel Sambuc #define	cond_signal(c) __empty
3120a6a1f1dSLionel Sambuc #define	cond_broadcast(c) __empty
3130a6a1f1dSLionel Sambuc #define	cond_wait(c, m) __empty
3140a6a1f1dSLionel Sambuc #define	cond_timedwait(c, m, t) __empty
3150a6a1f1dSLionel Sambuc #define	cond_destroy(c) __empty
3162fe8fb19SBen Gras 
3170a6a1f1dSLionel Sambuc #define	rwlock_init(l, a) __empty
3180a6a1f1dSLionel Sambuc #define	rwlock_rdlock(l) __empty
3190a6a1f1dSLionel Sambuc #define	rwlock_wrlock(l) __empty
3200a6a1f1dSLionel Sambuc #define	rwlock_tryrdlock(l) __empty
3210a6a1f1dSLionel Sambuc #define	rwlock_trywrlock(l) __empty
3220a6a1f1dSLionel Sambuc #define	rwlock_unlock(l) __empty
3230a6a1f1dSLionel Sambuc #define	rwlock_destroy(l) __empty
3242fe8fb19SBen Gras 
3250a6a1f1dSLionel Sambuc #define	thr_keycreate(k, d) /*LINTED*/0
3260a6a1f1dSLionel Sambuc #define	thr_setspecific(k, p) __empty
3270a6a1f1dSLionel Sambuc #define	thr_getspecific(k) /*LINTED*/0
3280a6a1f1dSLionel Sambuc #define	thr_keydelete(k) __empty
3290a6a1f1dSLionel Sambuc 
3300a6a1f1dSLionel Sambuc #define	mutexattr_init(ma) __empty
3310a6a1f1dSLionel Sambuc #define	mutexattr_settype(ma, t) __empty
3320a6a1f1dSLionel Sambuc #define	mutexattr_destroy(ma) __empty
3332fe8fb19SBen Gras 
334f14fb602SLionel Sambuc static inline int
335f14fb602SLionel Sambuc thr_once(once_t *once_control, void (*routine)(void))
336f14fb602SLionel Sambuc {
337f14fb602SLionel Sambuc 	if (__predict_false(once_control->pto_done == 0)) {
338f14fb602SLionel Sambuc 		(*routine)();
339f14fb602SLionel Sambuc 		once_control->pto_done = 1;
340f14fb602SLionel Sambuc 	}
341f14fb602SLionel Sambuc 	return 0;
342f14fb602SLionel Sambuc }
3430a6a1f1dSLionel Sambuc #define	thr_sigsetmask(f, n, o)	__empty
3440a6a1f1dSLionel Sambuc #define	thr_self() __empty
3450a6a1f1dSLionel Sambuc #define	thr_errno() __empty
3462fe8fb19SBen Gras #define	thr_curcpu()		((unsigned int)0)
3472fe8fb19SBen Gras 
3480a6a1f1dSLionel Sambuc #define	FLOCKFILE(fp) __empty
3490a6a1f1dSLionel Sambuc #define	FUNLOCKFILE(fp) __empty
3502fe8fb19SBen Gras 
3512fe8fb19SBen Gras #endif /* _REENTRANT */
352*180e7470SDavid van Moolenbroek 
353*180e7470SDavid van Moolenbroek #endif /* !defined(__minix) || !defined(_LIBC_REENTRANT_H) */
354