Home | History | Annotate | Line # | Download | only in thread-stub
thread-stub.c revision 1.14.10.1
      1  1.14.10.1      matt /*	$NetBSD: thread-stub.c,v 1.14.10.1 2008/01/09 01:34:26 matt Exp $	*/
      2        1.2   thorpej 
      3        1.2   thorpej /*-
      4        1.2   thorpej  * Copyright (c) 2003 The NetBSD Foundation, Inc.
      5        1.2   thorpej  * All rights reserved.
      6        1.2   thorpej  *
      7        1.2   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8        1.2   thorpej  * by Jason R. Thorpe.
      9        1.2   thorpej  *
     10        1.2   thorpej  * Redistribution and use in source and binary forms, with or without
     11        1.2   thorpej  * modification, are permitted provided that the following conditions
     12        1.2   thorpej  * are met:
     13        1.2   thorpej  * 1. Redistributions of source code must retain the above copyright
     14        1.2   thorpej  *    notice, this list of conditions and the following disclaimer.
     15        1.2   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16        1.2   thorpej  *    notice, this list of conditions and the following disclaimer in the
     17        1.2   thorpej  *    documentation and/or other materials provided with the distribution.
     18        1.2   thorpej  * 3. All advertising materials mentioning features or use of this software
     19        1.2   thorpej  *    must display the following acknowledgement:
     20        1.2   thorpej  *        This product includes software developed by the NetBSD
     21        1.2   thorpej  *        Foundation, Inc. and its contributors.
     22        1.2   thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23        1.2   thorpej  *    contributors may be used to endorse or promote products derived
     24        1.2   thorpej  *    from this software without specific prior written permission.
     25        1.2   thorpej  *
     26        1.2   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27        1.2   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28        1.2   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29        1.2   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30        1.2   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31        1.2   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32        1.2   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33        1.2   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34        1.2   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35        1.2   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36        1.2   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37        1.2   thorpej  */
     38        1.2   thorpej 
     39       1.13     lukem #include <sys/cdefs.h>
     40       1.13     lukem #if defined(LIBC_SCCS) && !defined(lint)
     41  1.14.10.1      matt __RCSID("$NetBSD: thread-stub.c,v 1.14.10.1 2008/01/09 01:34:26 matt Exp $");
     42       1.13     lukem #endif /* LIBC_SCCS and not lint */
     43       1.13     lukem 
     44        1.2   thorpej /*
     45        1.2   thorpej  * Stubs for thread operations, for use when threads are not used by
     46        1.2   thorpej  * the application.  See "reentrant.h" for details.
     47        1.2   thorpej  */
     48        1.2   thorpej 
     49        1.2   thorpej #ifdef _REENTRANT
     50        1.2   thorpej 
     51        1.2   thorpej #define	__LIBC_THREAD_STUBS
     52        1.2   thorpej 
     53        1.2   thorpej #include "namespace.h"
     54        1.2   thorpej #include "reentrant.h"
     55        1.2   thorpej 
     56        1.5   thorpej #include <errno.h>
     57        1.2   thorpej #include <signal.h>
     58        1.8      matt #include <stdlib.h>
     59        1.2   thorpej #include <unistd.h>
     60        1.2   thorpej 
     61        1.2   thorpej extern int __isthreaded;
     62        1.2   thorpej 
     63        1.2   thorpej #define	DIE()	(void)kill(getpid(), SIGABRT)
     64        1.2   thorpej 
     65        1.2   thorpej #define	CHECK_NOT_THREADED_ALWAYS()	\
     66        1.2   thorpej do {					\
     67        1.2   thorpej 	if (__isthreaded)		\
     68        1.2   thorpej 		DIE();			\
     69        1.2   thorpej } while (/*CONSTCOND*/0)
     70        1.2   thorpej 
     71        1.2   thorpej #if 1
     72        1.2   thorpej #define	CHECK_NOT_THREADED()	CHECK_NOT_THREADED_ALWAYS()
     73        1.2   thorpej #else
     74        1.2   thorpej #define	CHECK_NOT_THREADED()	/* nothing */
     75        1.2   thorpej #endif
     76        1.2   thorpej 
     77  1.14.10.1      matt /* libpthread init */
     78  1.14.10.1      matt 
     79  1.14.10.1      matt void	__libc_thr_init(void);
     80  1.14.10.1      matt void	__libc_thr_init_stub(void);
     81  1.14.10.1      matt 
     82  1.14.10.1      matt __weak_alias(__libc_thr_init,__libc_thr_init_stub)
     83  1.14.10.1      matt 
     84  1.14.10.1      matt void
     85  1.14.10.1      matt __libc_thr_init_stub(void)
     86  1.14.10.1      matt {
     87  1.14.10.1      matt 
     88  1.14.10.1      matt 	/* nothing, may be overridden by libpthread */
     89  1.14.10.1      matt }
     90  1.14.10.1      matt 
     91        1.2   thorpej /* mutexes */
     92        1.2   thorpej 
     93        1.2   thorpej int	__libc_mutex_init_stub(mutex_t *, const mutexattr_t *);
     94        1.2   thorpej int	__libc_mutex_catchall_stub(mutex_t *);
     95        1.2   thorpej 
     96        1.2   thorpej __weak_alias(__libc_mutex_init,__libc_mutex_init_stub)
     97        1.2   thorpej __weak_alias(__libc_mutex_lock,__libc_mutex_catchall_stub)
     98        1.2   thorpej __weak_alias(__libc_mutex_trylock,__libc_mutex_catchall_stub)
     99        1.2   thorpej __weak_alias(__libc_mutex_unlock,__libc_mutex_catchall_stub)
    100        1.2   thorpej __weak_alias(__libc_mutex_destroy,__libc_mutex_catchall_stub)
    101        1.2   thorpej 
    102        1.4   thorpej int	__libc_mutexattr_catchall_stub(mutexattr_t *);
    103        1.4   thorpej int	__libc_mutexattr_settype_stub(mutexattr_t *, int);
    104        1.4   thorpej 
    105        1.4   thorpej __weak_alias(__libc_mutexattr_init,__libc_mutexattr_catchall_stub)
    106        1.4   thorpej __weak_alias(__libc_mutexattr_destroy,__libc_mutexattr_catchall_stub)
    107        1.4   thorpej __weak_alias(__libc_mutexattr_settype,__libc_mutexattr_settype_stub)
    108        1.4   thorpej 
    109        1.2   thorpej int
    110        1.2   thorpej __libc_mutex_init_stub(mutex_t *m, const mutexattr_t *a)
    111        1.2   thorpej {
    112        1.2   thorpej 	/* LINTED deliberate lack of effect */
    113        1.2   thorpej 	(void)m;
    114        1.2   thorpej 	/* LINTED deliberate lack of effect */
    115        1.2   thorpej 	(void)a;
    116        1.2   thorpej 
    117        1.2   thorpej 	CHECK_NOT_THREADED();
    118        1.2   thorpej 
    119        1.2   thorpej 	return (0);
    120        1.2   thorpej }
    121        1.2   thorpej 
    122        1.2   thorpej int
    123        1.2   thorpej __libc_mutex_catchall_stub(mutex_t *m)
    124        1.2   thorpej {
    125        1.2   thorpej 	/* LINTED deliberate lack of effect */
    126        1.2   thorpej 	(void)m;
    127        1.2   thorpej 
    128        1.2   thorpej 	CHECK_NOT_THREADED();
    129        1.2   thorpej 
    130        1.2   thorpej 	return (0);
    131        1.2   thorpej }
    132        1.2   thorpej 
    133        1.4   thorpej int
    134        1.4   thorpej __libc_mutexattr_settype_stub(mutexattr_t *ma, int type)
    135        1.4   thorpej {
    136        1.4   thorpej 	/* LINTED deliberate lack of effect */
    137        1.4   thorpej 	(void)ma;
    138        1.4   thorpej 	/* LINTED deliberate lack of effect */
    139        1.4   thorpej 	(void)type;
    140        1.4   thorpej 
    141        1.4   thorpej 	return (0);
    142        1.4   thorpej }
    143        1.4   thorpej 
    144        1.4   thorpej int
    145        1.4   thorpej __libc_mutexattr_catchall_stub(mutexattr_t *ma)
    146        1.4   thorpej {
    147        1.4   thorpej 	/* LINTED deliberate lack of effect */
    148        1.4   thorpej 	(void)ma;
    149        1.4   thorpej 
    150        1.4   thorpej 	CHECK_NOT_THREADED();
    151        1.4   thorpej 
    152        1.4   thorpej 	return (0);
    153        1.4   thorpej }
    154        1.2   thorpej 
    155        1.2   thorpej /* condition variables */
    156        1.2   thorpej 
    157        1.2   thorpej int	__libc_cond_init_stub(cond_t *, const condattr_t *);
    158        1.2   thorpej int	__libc_cond_wait_stub(cond_t *, mutex_t *);
    159        1.2   thorpej int	__libc_cond_timedwait_stub(cond_t *, mutex_t *,
    160        1.2   thorpej 				   const struct timespec *);
    161        1.2   thorpej int	__libc_cond_catchall_stub(cond_t *);
    162        1.2   thorpej 
    163        1.2   thorpej __weak_alias(__libc_cond_init,__libc_cond_init_stub)
    164        1.2   thorpej __weak_alias(__libc_cond_signal,__libc_cond_catchall_stub)
    165        1.2   thorpej __weak_alias(__libc_cond_broadcast,__libc_cond_catchall_stub)
    166        1.2   thorpej __weak_alias(__libc_cond_wait,__libc_cond_wait_stub)
    167        1.2   thorpej __weak_alias(__libc_cond_timedwait,__libc_cond_timedwait_stub)
    168        1.2   thorpej __weak_alias(__libc_cond_destroy,__libc_cond_catchall_stub)
    169        1.2   thorpej 
    170        1.2   thorpej int
    171        1.2   thorpej __libc_cond_init_stub(cond_t *c, const condattr_t *a)
    172        1.2   thorpej {
    173        1.2   thorpej 	/* LINTED deliberate lack of effect */
    174        1.2   thorpej 	(void)c;
    175        1.2   thorpej 	/* LINTED deliberate lack of effect */
    176        1.2   thorpej 	(void)a;
    177        1.2   thorpej 
    178        1.2   thorpej 	CHECK_NOT_THREADED();
    179        1.2   thorpej 
    180        1.2   thorpej 	return (0);
    181        1.2   thorpej }
    182        1.2   thorpej 
    183        1.2   thorpej int
    184        1.2   thorpej __libc_cond_wait_stub(cond_t *c, mutex_t *m)
    185        1.2   thorpej {
    186        1.2   thorpej 	/* LINTED deliberate lack of effect */
    187        1.2   thorpej 	(void)c;
    188        1.2   thorpej 	/* LINTED deliberate lack of effect */
    189        1.2   thorpej 	(void)m;
    190        1.2   thorpej 
    191        1.2   thorpej 	CHECK_NOT_THREADED();
    192        1.2   thorpej 
    193        1.2   thorpej 	return (0);
    194        1.2   thorpej }
    195        1.2   thorpej 
    196        1.2   thorpej int
    197        1.2   thorpej __libc_cond_timedwait_stub(cond_t *c, mutex_t *m, const struct timespec *t)
    198        1.2   thorpej {
    199        1.2   thorpej 	/* LINTED deliberate lack of effect */
    200        1.2   thorpej 	(void)c;
    201        1.2   thorpej 	/* LINTED deliberate lack of effect */
    202        1.2   thorpej 	(void)m;
    203        1.2   thorpej 	/* LINTED deliberate lack of effect */
    204        1.2   thorpej 	(void)t;
    205        1.2   thorpej 
    206        1.2   thorpej 	CHECK_NOT_THREADED();
    207        1.2   thorpej 
    208        1.2   thorpej 	return (0);
    209        1.2   thorpej }
    210        1.2   thorpej 
    211        1.2   thorpej int
    212        1.2   thorpej __libc_cond_catchall_stub(cond_t *c)
    213        1.2   thorpej {
    214        1.2   thorpej 	/* LINTED deliberate lack of effect */
    215        1.2   thorpej 	(void)c;
    216        1.2   thorpej 
    217        1.2   thorpej 	CHECK_NOT_THREADED();
    218        1.2   thorpej 
    219        1.2   thorpej 	return (0);
    220        1.2   thorpej }
    221        1.2   thorpej 
    222        1.2   thorpej 
    223        1.2   thorpej /* read-write locks */
    224        1.2   thorpej 
    225        1.2   thorpej int	__libc_rwlock_init_stub(rwlock_t *, rwlockattr_t *);
    226        1.2   thorpej int	__libc_rwlock_catchall_stub(rwlock_t *);
    227        1.2   thorpej 
    228        1.2   thorpej __weak_alias(__libc_rwlock_init,__libc_rwlock_init_stub)
    229        1.2   thorpej __weak_alias(__libc_rwlock_rdlock,__libc_rwlock_catchall_stub)
    230        1.2   thorpej __weak_alias(__libc_rwlock_wrlock,__libc_rwlock_catchall_stub)
    231        1.2   thorpej __weak_alias(__libc_rwlock_tryrdlock,__libc_rwlock_catchall_stub)
    232        1.2   thorpej __weak_alias(__libc_rwlock_trywrlock,__libc_rwlock_catchall_stub)
    233        1.2   thorpej __weak_alias(__libc_rwlock_unlock,__libc_rwlock_catchall_stub)
    234        1.2   thorpej __weak_alias(__libc_rwlock_destroy,__libc_rwlock_catchall_stub)
    235        1.2   thorpej 
    236        1.2   thorpej int
    237        1.2   thorpej __libc_rwlock_init_stub(rwlock_t *l, rwlockattr_t *a)
    238        1.2   thorpej {
    239        1.2   thorpej 	/* LINTED deliberate lack of effect */
    240        1.2   thorpej 	(void)l;
    241        1.2   thorpej 	/* LINTED deliberate lack of effect */
    242        1.2   thorpej 	(void)a;
    243        1.2   thorpej 
    244        1.2   thorpej 	CHECK_NOT_THREADED();
    245        1.2   thorpej 
    246        1.2   thorpej 	return (0);
    247        1.2   thorpej }
    248        1.2   thorpej 
    249        1.2   thorpej int
    250        1.2   thorpej __libc_rwlock_catchall_stub(rwlock_t *l)
    251        1.2   thorpej {
    252        1.2   thorpej 	/* LINTED deliberate lack of effect */
    253        1.2   thorpej 	(void)l;
    254        1.2   thorpej 
    255        1.2   thorpej 	CHECK_NOT_THREADED();
    256        1.2   thorpej 
    257        1.2   thorpej 	return (0);
    258        1.2   thorpej }
    259        1.2   thorpej 
    260        1.2   thorpej 
    261        1.7   thorpej /*
    262        1.7   thorpej  * thread-specific data; we need to actually provide a simple TSD
    263        1.7   thorpej  * implementation, since some thread-safe libraries want to use it.
    264        1.7   thorpej  */
    265        1.7   thorpej 
    266        1.7   thorpej #define	TSD_KEYS_MAX	64
    267        1.7   thorpej 
    268        1.7   thorpej static struct {
    269        1.7   thorpej 	void *tsd_val;
    270        1.7   thorpej 	void (*tsd_dtor)(void *);
    271        1.7   thorpej 	int tsd_inuse;
    272        1.7   thorpej } __libc_tsd[TSD_KEYS_MAX];
    273        1.7   thorpej static int __libc_tsd_nextkey;
    274        1.2   thorpej 
    275        1.2   thorpej int	__libc_thr_keycreate_stub(thread_key_t *, void (*)(void *));
    276        1.2   thorpej int	__libc_thr_setspecific_stub(thread_key_t, const void *);
    277        1.2   thorpej void	*__libc_thr_getspecific_stub(thread_key_t);
    278        1.2   thorpej int	__libc_thr_keydelete_stub(thread_key_t);
    279        1.2   thorpej 
    280        1.2   thorpej __weak_alias(__libc_thr_keycreate,__libc_thr_keycreate_stub)
    281        1.2   thorpej __weak_alias(__libc_thr_setspecific,__libc_thr_setspecific_stub)
    282        1.2   thorpej __weak_alias(__libc_thr_getspecific,__libc_thr_getspecific_stub)
    283        1.2   thorpej __weak_alias(__libc_thr_keydelete,__libc_thr_keydelete_stub)
    284        1.2   thorpej 
    285        1.2   thorpej int
    286        1.2   thorpej __libc_thr_keycreate_stub(thread_key_t *k, void (*d)(void *))
    287        1.2   thorpej {
    288        1.7   thorpej 	int i;
    289        1.2   thorpej 
    290        1.7   thorpej 	for (i = __libc_tsd_nextkey; i < TSD_KEYS_MAX; i++) {
    291        1.7   thorpej 		if (__libc_tsd[i].tsd_inuse == 0)
    292        1.7   thorpej 			goto out;
    293        1.7   thorpej 	}
    294        1.7   thorpej 
    295        1.7   thorpej 	for (i = 0; i < __libc_tsd_nextkey; i++) {
    296        1.7   thorpej 		if (__libc_tsd[i].tsd_inuse == 0)
    297        1.7   thorpej 			goto out;
    298        1.7   thorpej 	}
    299        1.7   thorpej 
    300        1.7   thorpej 	return (EAGAIN);
    301        1.7   thorpej 
    302        1.7   thorpej  out:
    303        1.7   thorpej 	/*
    304        1.7   thorpej 	 * XXX We don't actually do anything with the destructor.  We
    305        1.7   thorpej 	 * XXX probably should.
    306        1.7   thorpej 	 */
    307        1.7   thorpej 	__libc_tsd[i].tsd_inuse = 1;
    308        1.7   thorpej 	__libc_tsd_nextkey = (i + i) % TSD_KEYS_MAX;
    309        1.7   thorpej 	__libc_tsd[i].tsd_dtor = d;
    310        1.7   thorpej 	*k = i;
    311        1.2   thorpej 
    312        1.2   thorpej 	return (0);
    313        1.2   thorpej }
    314        1.2   thorpej 
    315        1.2   thorpej int
    316        1.2   thorpej __libc_thr_setspecific_stub(thread_key_t k, const void *v)
    317        1.2   thorpej {
    318        1.2   thorpej 
    319       1.14  christos 	__libc_tsd[k].tsd_val = __UNCONST(v);
    320        1.2   thorpej 
    321        1.2   thorpej 	return (0);
    322        1.2   thorpej }
    323        1.2   thorpej 
    324        1.2   thorpej void *
    325        1.2   thorpej __libc_thr_getspecific_stub(thread_key_t k)
    326        1.2   thorpej {
    327        1.2   thorpej 
    328        1.7   thorpej 	return (__libc_tsd[k].tsd_val);
    329        1.2   thorpej }
    330        1.2   thorpej 
    331        1.2   thorpej int
    332        1.2   thorpej __libc_thr_keydelete_stub(thread_key_t k)
    333        1.2   thorpej {
    334        1.2   thorpej 
    335        1.7   thorpej 	/*
    336        1.7   thorpej 	 * XXX Do not recycle key; see big comment in libpthread.
    337        1.7   thorpej 	 */
    338        1.7   thorpej 
    339        1.7   thorpej 	__libc_tsd[k].tsd_dtor = NULL;
    340        1.2   thorpej 
    341        1.2   thorpej 	return (0);
    342        1.2   thorpej }
    343        1.2   thorpej 
    344        1.2   thorpej 
    345        1.2   thorpej /* misc. */
    346        1.2   thorpej 
    347        1.2   thorpej int	__libc_thr_once_stub(once_t *, void (*)(void));
    348        1.2   thorpej int	__libc_thr_sigsetmask_stub(int, const sigset_t *, sigset_t *);
    349        1.2   thorpej thr_t	__libc_thr_self_stub(void);
    350       1.12   nathanw int	__libc_thr_yield_stub(void);
    351        1.5   thorpej int	__libc_thr_create_stub(thr_t *, const thrattr_t *,
    352        1.5   thorpej 	    void *(*)(void *), void *);
    353        1.5   thorpej void	__libc_thr_exit_stub(void *);
    354        1.2   thorpej int	*__libc_thr_errno_stub(void);
    355        1.9   nathanw int	__libc_thr_setcancelstate_stub(int, int *);
    356  1.14.10.1      matt int	__libc_thr_equal_stub(pthread_t, pthread_t);
    357  1.14.10.1      matt unsigned int __libc_thr_curcpu_stub(void);
    358        1.2   thorpej 
    359        1.2   thorpej __weak_alias(__libc_thr_once,__libc_thr_once_stub)
    360        1.2   thorpej __weak_alias(__libc_thr_sigsetmask,__libc_thr_sigsetmask_stub)
    361        1.2   thorpej __weak_alias(__libc_thr_self,__libc_thr_self_stub)
    362        1.5   thorpej __weak_alias(__libc_thr_yield,__libc_thr_yield_stub)
    363        1.5   thorpej __weak_alias(__libc_thr_create,__libc_thr_create_stub)
    364        1.5   thorpej __weak_alias(__libc_thr_exit,__libc_thr_exit_stub)
    365        1.2   thorpej __weak_alias(__libc_thr_errno,__libc_thr_errno_stub)
    366        1.9   nathanw __weak_alias(__libc_thr_setcancelstate,__libc_thr_setcancelstate_stub)
    367  1.14.10.1      matt __weak_alias(__libc_thr_equal,__libc_thr_equal_stub)
    368  1.14.10.1      matt __weak_alias(__libc_thr_curcpu,__libc_thr_curcpu_stub)
    369        1.2   thorpej 
    370        1.5   thorpej 
    371        1.2   thorpej int
    372        1.2   thorpej __libc_thr_once_stub(once_t *o, void (*r)(void))
    373        1.2   thorpej {
    374        1.2   thorpej 
    375        1.3   thorpej 	/* XXX Knowledge of libpthread types. */
    376        1.3   thorpej 
    377        1.3   thorpej 	if (o->pto_done == 0) {
    378        1.3   thorpej 		(*r)();
    379        1.3   thorpej 		o->pto_done = 1;
    380        1.3   thorpej 	}
    381        1.2   thorpej 
    382        1.2   thorpej 	return (0);
    383        1.2   thorpej }
    384        1.2   thorpej 
    385        1.2   thorpej int
    386        1.2   thorpej __libc_thr_sigsetmask_stub(int h, const sigset_t *s, sigset_t *o)
    387        1.2   thorpej {
    388        1.2   thorpej 
    389        1.2   thorpej 	CHECK_NOT_THREADED();
    390        1.2   thorpej 
    391       1.10   nathanw 	return sigprocmask(h, s, o);
    392        1.2   thorpej }
    393        1.2   thorpej 
    394        1.2   thorpej thr_t
    395        1.2   thorpej __libc_thr_self_stub(void)
    396        1.2   thorpej {
    397        1.2   thorpej 
    398        1.6   thorpej 	return ((thr_t) -1);
    399        1.5   thorpej }
    400        1.5   thorpej 
    401       1.11   nathanw int
    402        1.5   thorpej __libc_thr_yield_stub(void)
    403        1.5   thorpej {
    404        1.5   thorpej 
    405        1.5   thorpej 	/* Nothing to do. */
    406       1.11   nathanw 	return (0);
    407        1.5   thorpej }
    408        1.5   thorpej 
    409        1.5   thorpej int
    410        1.5   thorpej __libc_thr_create_stub(thr_t *tp, const thrattr_t *ta,
    411        1.5   thorpej     void *(*f)(void *), void *a)
    412        1.5   thorpej {
    413        1.5   thorpej 	/* LINTED deliberate lack of effect */
    414        1.5   thorpej 	(void)tp;
    415        1.5   thorpej 	/* LINTED deliberate lack of effect */
    416        1.5   thorpej 	(void)ta;
    417        1.5   thorpej 	/* LINTED deliberate lack of effect */
    418        1.5   thorpej 	(void)f;
    419        1.5   thorpej 	/* LINTED deliberate lack of effect */
    420        1.5   thorpej 	(void)a;
    421        1.5   thorpej 
    422        1.2   thorpej 	DIE();
    423        1.2   thorpej 
    424        1.5   thorpej 	return (EOPNOTSUPP);
    425        1.5   thorpej }
    426        1.5   thorpej 
    427        1.5   thorpej void
    428        1.5   thorpej __libc_thr_exit_stub(void *v)
    429        1.5   thorpej {
    430        1.5   thorpej 	/* LINTED deliberate lack of effect */
    431        1.5   thorpej 	(void)v;
    432        1.5   thorpej 	exit(0);
    433        1.9   nathanw }
    434        1.9   nathanw 
    435        1.9   nathanw int
    436        1.9   nathanw __libc_thr_setcancelstate_stub(int new, int *old)
    437        1.9   nathanw {
    438        1.9   nathanw 	/* LINTED deliberate lack of effect */
    439        1.9   nathanw 	(void)new;
    440        1.9   nathanw 
    441        1.9   nathanw 	/* LINTED deliberate lack of effect */
    442        1.9   nathanw 	(void)old;
    443        1.9   nathanw 
    444        1.9   nathanw 	CHECK_NOT_THREADED();
    445        1.9   nathanw 
    446        1.9   nathanw 	return (0);
    447        1.2   thorpej }
    448        1.2   thorpej 
    449  1.14.10.1      matt int
    450  1.14.10.1      matt __libc_thr_equal_stub(pthread_t t1, pthread_t t2)
    451  1.14.10.1      matt {
    452  1.14.10.1      matt 
    453  1.14.10.1      matt 	/* assert that t1=t2=pthread_self() */
    454  1.14.10.1      matt 	return (t1 == t2);
    455  1.14.10.1      matt }
    456  1.14.10.1      matt 
    457        1.2   thorpej int *
    458        1.2   thorpej __libc_thr_errno_stub(void)
    459        1.2   thorpej {
    460        1.2   thorpej 
    461        1.2   thorpej 	DIE();
    462        1.2   thorpej 
    463        1.2   thorpej 	return (NULL);
    464        1.2   thorpej }
    465        1.2   thorpej 
    466  1.14.10.1      matt unsigned int
    467  1.14.10.1      matt __libc_thr_curcpu_stub(void)
    468  1.14.10.1      matt {
    469  1.14.10.1      matt 
    470  1.14.10.1      matt 	return (0);
    471  1.14.10.1      matt }
    472  1.14.10.1      matt 
    473        1.2   thorpej #endif /* _REENTRANT */
    474