xref: /dflybsd-src/lib/libthread_xu/thread/thr_rtld.c (revision 982472833bfaf7f80422693d9d6752ca14334a18)
171b3fa15SDavid Xu /*
2d3b15642Szrj  * Copyright (c) 2006, David Xu <davidxu@freebsd.org>
371b3fa15SDavid Xu  * All rights reserved.
471b3fa15SDavid Xu  *
571b3fa15SDavid Xu  * Redistribution and use in source and binary forms, with or without
671b3fa15SDavid Xu  * modification, are permitted provided that the following conditions
771b3fa15SDavid Xu  * are met:
871b3fa15SDavid Xu  * 1. Redistributions of source code must retain the above copyright
9d3b15642Szrj  *    notice unmodified, this list of conditions, and the following
10d3b15642Szrj  *    disclaimer.
1171b3fa15SDavid Xu  * 2. Redistributions in binary form must reproduce the above copyright
1271b3fa15SDavid Xu  *    notice, this list of conditions and the following disclaimer in the
1371b3fa15SDavid Xu  *    documentation and/or other materials provided with the distribution.
1471b3fa15SDavid Xu  *
1571b3fa15SDavid Xu  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1671b3fa15SDavid Xu  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1771b3fa15SDavid Xu  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1871b3fa15SDavid Xu  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1971b3fa15SDavid Xu  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2071b3fa15SDavid Xu  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2171b3fa15SDavid Xu  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2271b3fa15SDavid Xu  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2371b3fa15SDavid Xu  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2471b3fa15SDavid Xu  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2571b3fa15SDavid Xu  *
2671b3fa15SDavid Xu  * $FreeBSD: src/lib/libpthread/thread/thr_rtld.c,v 1.5 2003/11/05 18:19:24 deischen Exp $
2771b3fa15SDavid Xu  */
289e2ee207SJoerg Sonnenberger 
2916fb9086SImre Vadász #include "namespace.h"
3019451dc5Szrj #include <machine/tls.h>
3171b3fa15SDavid Xu #include <stdlib.h>
32fcaa7a3aSMatthew Dillon #include <string.h>
3371b3fa15SDavid Xu #include <pthread.h>
3471b3fa15SDavid Xu 
3516fb9086SImre Vadász #include "un-namespace.h"
3671b3fa15SDavid Xu #include "rtld_lock.h"
3771b3fa15SDavid Xu #include "thr_private.h"
3871b3fa15SDavid Xu 
3971b3fa15SDavid Xu void
_thr_rtld_init(void)4071b3fa15SDavid Xu _thr_rtld_init(void)
4171b3fa15SDavid Xu {
42fcaa7a3aSMatthew Dillon 	static int once = 0;
4371b3fa15SDavid Xu 
44*98247283SMatthew Dillon 	_rtld_thread_init(NULL);
45fcaa7a3aSMatthew Dillon 	if (once == 0) {
46fcaa7a3aSMatthew Dillon 		once = 1;
47fcaa7a3aSMatthew Dillon 		_thr_atfork_kern(_rtld_thread_prefork,
48fcaa7a3aSMatthew Dillon 				 _rtld_thread_postfork,
49fcaa7a3aSMatthew Dillon 				 _rtld_thread_childfork);
50fcaa7a3aSMatthew Dillon 	}
5171b3fa15SDavid Xu }
5271b3fa15SDavid Xu 
5371b3fa15SDavid Xu void
_thr_rtld_fini(void)5471b3fa15SDavid Xu _thr_rtld_fini(void)
5571b3fa15SDavid Xu {
56*98247283SMatthew Dillon 	/* _rtld_thread_init(NULL); */
5771b3fa15SDavid Xu }
58