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