Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2019 19:27:20 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350481 - head/lib/libthr/thread
Message-ID:  <201907311927.x6VJRKah057978@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Jul 31 19:27:20 2019
New Revision: 350481
URL: https://svnweb.freebsd.org/changeset/base/350481

Log:
  Avoid conflicts with libc symbols in libthr jump table.
  
  In some corner cases of static linking and unexpected libraries order
  on the linker command line, libc symbol might preempt the same libthr
  symbol, in which case libthr jump table points back to libc causing
  either infinite recursion or loop.  Handle all of such symbols by
  using private libthr names for them, ensuring that the right pointers
  are installed into the table.
  
  In collaboration with: arichardson
  PR:	239475
  Tested by:	pho
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21088

Modified:
  head/lib/libthr/thread/thr_attr.c
  head/lib/libthr/thread/thr_cancel.c
  head/lib/libthr/thread/thr_clean.c
  head/lib/libthr/thread/thr_cond.c
  head/lib/libthr/thread/thr_detach.c
  head/lib/libthr/thread/thr_equal.c
  head/lib/libthr/thread/thr_exit.c
  head/lib/libthr/thread/thr_fork.c
  head/lib/libthr/thread/thr_getthreadid_np.c
  head/lib/libthr/thread/thr_init.c
  head/lib/libthr/thread/thr_join.c
  head/lib/libthr/thread/thr_kill.c
  head/lib/libthr/thread/thr_main_np.c
  head/lib/libthr/thread/thr_mutex.c
  head/lib/libthr/thread/thr_mutexattr.c
  head/lib/libthr/thread/thr_once.c
  head/lib/libthr/thread/thr_private.h
  head/lib/libthr/thread/thr_rwlock.c
  head/lib/libthr/thread/thr_self.c
  head/lib/libthr/thread/thr_sig.c
  head/lib/libthr/thread/thr_spec.c

Modified: head/lib/libthr/thread/thr_attr.c
==============================================================================
--- head/lib/libthr/thread/thr_attr.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_attr.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -109,10 +109,11 @@ __FBSDID("$FreeBSD$");
 
 static size_t	_get_kern_cpuset_size(void);
 
-__weak_reference(_pthread_attr_destroy, pthread_attr_destroy);
+__weak_reference(_thr_attr_destroy, _pthread_attr_destroy);
+__weak_reference(_thr_attr_destroy, pthread_attr_destroy);
 
 int
-_pthread_attr_destroy(pthread_attr_t *attr)
+_thr_attr_destroy(pthread_attr_t *attr)
 {
 	int	ret;
 
@@ -136,10 +137,11 @@ _pthread_attr_destroy(pthread_attr_t *attr)
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
+__weak_reference(_thr_attr_get_np, pthread_attr_get_np);
+__weak_reference(_thr_attr_get_np, _pthread_attr_get_np);
 
 int
-_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
+_thr_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
 {
 	struct pthread *curthread;
 	struct pthread_attr attr, *dst;
@@ -173,10 +175,11 @@ _pthread_attr_get_np(pthread_t pthread, pthread_attr_t
 	return (ret);
 }
 
-__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);
+__weak_reference(_thr_attr_getdetachstate, pthread_attr_getdetachstate);
+__weak_reference(_thr_attr_getdetachstate, _pthread_attr_getdetachstate);
 
 int
-_pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
+_thr_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
 {
 	int	ret;
 
@@ -196,10 +199,11 @@ _pthread_attr_getdetachstate(const pthread_attr_t *att
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize);
+__weak_reference(_thr_attr_getguardsize, pthread_attr_getguardsize);
+__weak_reference(_thr_attr_getguardsize, _pthread_attr_getguardsize);
 
 int
-_pthread_attr_getguardsize(const pthread_attr_t * __restrict attr,
+_thr_attr_getguardsize(const pthread_attr_t * __restrict attr,
     size_t * __restrict guardsize)
 {
 	int	ret;
@@ -215,10 +219,11 @@ _pthread_attr_getguardsize(const pthread_attr_t * __re
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched);
+__weak_reference(_thr_attr_getinheritsched, pthread_attr_getinheritsched);
+__weak_reference(_thr_attr_getinheritsched, _pthread_attr_getinheritsched);
 
 int
-_pthread_attr_getinheritsched(const pthread_attr_t * __restrict attr,
+_thr_attr_getinheritsched(const pthread_attr_t * __restrict attr,
     int * __restrict sched_inherit)
 {
 	int ret = 0;
@@ -231,10 +236,11 @@ _pthread_attr_getinheritsched(const pthread_attr_t * _
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);
+__weak_reference(_thr_attr_getschedparam, pthread_attr_getschedparam);
+__weak_reference(_thr_attr_getschedparam, _pthread_attr_getschedparam);
 
 int
-_pthread_attr_getschedparam(const pthread_attr_t * __restrict attr,
+_thr_attr_getschedparam(const pthread_attr_t * __restrict attr,
     struct sched_param * __restrict param)
 {
 	int ret = 0;
@@ -247,10 +253,11 @@ _pthread_attr_getschedparam(const pthread_attr_t * __r
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getschedpolicy, pthread_attr_getschedpolicy);
+__weak_reference(_thr_attr_getschedpolicy, pthread_attr_getschedpolicy);
+__weak_reference(_thr_attr_getschedpolicy, _pthread_attr_getschedpolicy);
 
 int
-_pthread_attr_getschedpolicy(const pthread_attr_t * __restrict attr,
+_thr_attr_getschedpolicy(const pthread_attr_t * __restrict attr,
     int * __restrict policy)
 {
 	int ret = 0;
@@ -263,10 +270,11 @@ _pthread_attr_getschedpolicy(const pthread_attr_t * __
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getscope, pthread_attr_getscope);
+__weak_reference(_thr_attr_getscope, pthread_attr_getscope);
+__weak_reference(_thr_attr_getscope, _pthread_attr_getscope);
 
 int
-_pthread_attr_getscope(const pthread_attr_t * __restrict attr,
+_thr_attr_getscope(const pthread_attr_t * __restrict attr,
     int * __restrict contentionscope)
 {
 	int ret = 0;
@@ -286,8 +294,7 @@ __weak_reference(_pthread_attr_getstack, pthread_attr_
 
 int
 _pthread_attr_getstack(const pthread_attr_t * __restrict attr,
-                        void ** __restrict stackaddr,
-                        size_t * __restrict stacksize)
+    void ** __restrict stackaddr, size_t * __restrict stacksize)
 {
 	int     ret;
 
@@ -304,10 +311,11 @@ _pthread_attr_getstack(const pthread_attr_t * __restri
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getstackaddr, pthread_attr_getstackaddr);
+__weak_reference(_thr_attr_getstackaddr, pthread_attr_getstackaddr);
+__weak_reference(_thr_attr_getstackaddr, _pthread_attr_getstackaddr);
 
 int
-_pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
+_thr_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
 {
 	int	ret;
 
@@ -322,10 +330,11 @@ _pthread_attr_getstackaddr(const pthread_attr_t *attr,
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getstacksize, pthread_attr_getstacksize);
+__weak_reference(_thr_attr_getstacksize, pthread_attr_getstacksize);
+__weak_reference(_thr_attr_getstacksize, _pthread_attr_getstacksize);
 
 int
-_pthread_attr_getstacksize(const pthread_attr_t * __restrict attr,
+_thr_attr_getstacksize(const pthread_attr_t * __restrict attr,
     size_t * __restrict stacksize)
 {
 	int	ret;
@@ -341,10 +350,11 @@ _pthread_attr_getstacksize(const pthread_attr_t * __re
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_init, pthread_attr_init);
+__weak_reference(_thr_attr_init, pthread_attr_init);
+__weak_reference(_thr_attr_init, _pthread_attr_init);
 
 int
-_pthread_attr_init(pthread_attr_t *attr)
+_thr_attr_init(pthread_attr_t *attr)
 {
 	int	ret;
 	pthread_attr_t	pattr;
@@ -382,10 +392,11 @@ _pthread_attr_setcreatesuspend_np(pthread_attr_t *attr
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setdetachstate, pthread_attr_setdetachstate);
+__weak_reference(_thr_attr_setdetachstate, pthread_attr_setdetachstate);
+__weak_reference(_thr_attr_setdetachstate, _pthread_attr_setdetachstate);
 
 int
-_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+_thr_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
 {
 	int	ret;
 
@@ -407,10 +418,11 @@ _pthread_attr_setdetachstate(pthread_attr_t *attr, int
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setguardsize, pthread_attr_setguardsize);
+__weak_reference(_thr_attr_setguardsize, pthread_attr_setguardsize);
+__weak_reference(_thr_attr_setguardsize, _pthread_attr_setguardsize);
 
 int
-_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
+_thr_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
 {
 	int	ret;
 
@@ -425,10 +437,11 @@ _pthread_attr_setguardsize(pthread_attr_t *attr, size_
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched);
+__weak_reference(_thr_attr_setinheritsched, pthread_attr_setinheritsched);
+__weak_reference(_thr_attr_setinheritsched, _pthread_attr_setinheritsched);
 
 int
-_pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
+_thr_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
 {
 	int ret = 0;
 
@@ -443,10 +456,11 @@ _pthread_attr_setinheritsched(pthread_attr_t *attr, in
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setschedparam, pthread_attr_setschedparam);
+__weak_reference(_thr_attr_setschedparam, pthread_attr_setschedparam);
+__weak_reference(_thr_attr_setschedparam, _pthread_attr_setschedparam);
 
 int
-_pthread_attr_setschedparam(pthread_attr_t * __restrict attr,
+_thr_attr_setschedparam(pthread_attr_t * __restrict attr,
     const struct sched_param * __restrict param)
 {
 	int policy;
@@ -476,10 +490,11 @@ _pthread_attr_setschedparam(pthread_attr_t * __restric
 	return (0);
 }
 
-__weak_reference(_pthread_attr_setschedpolicy, pthread_attr_setschedpolicy);
+__weak_reference(_thr_attr_setschedpolicy, pthread_attr_setschedpolicy);
+__weak_reference(_thr_attr_setschedpolicy, _pthread_attr_setschedpolicy);
 
 int
-_pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
+_thr_attr_setschedpolicy(pthread_attr_t *attr, int policy)
 {
 	int ret = 0;
 
@@ -494,10 +509,11 @@ _pthread_attr_setschedpolicy(pthread_attr_t *attr, int
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setscope, pthread_attr_setscope);
+__weak_reference(_thr_attr_setscope, pthread_attr_setscope);
+__weak_reference(_thr_attr_setscope, _pthread_attr_setscope);
 
 int
-_pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
+_thr_attr_setscope(pthread_attr_t *attr, int contentionscope)
 {
 	int ret = 0;
 
@@ -536,10 +552,11 @@ _pthread_attr_setstack(pthread_attr_t *attr, void *sta
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setstackaddr, pthread_attr_setstackaddr);
+__weak_reference(_thr_attr_setstackaddr, pthread_attr_setstackaddr);
+__weak_reference(_thr_attr_setstackaddr, _pthread_attr_setstackaddr);
 
 int
-_pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
+_thr_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
 {
 	int	ret;
 
@@ -554,10 +571,11 @@ _pthread_attr_setstackaddr(pthread_attr_t *attr, void 
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setstacksize, pthread_attr_setstacksize);
+__weak_reference(_thr_attr_setstacksize, pthread_attr_setstacksize);
+__weak_reference(_thr_attr_setstacksize, _pthread_attr_setstacksize);
 
 int
-_pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
+_thr_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
 {
 	int	ret;
 

Modified: head/lib/libthr/thread/thr_cancel.c
==============================================================================
--- head/lib/libthr/thread/thr_cancel.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_cancel.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -35,10 +35,14 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_cancel, pthread_cancel);
-__weak_reference(_pthread_setcancelstate, pthread_setcancelstate);
-__weak_reference(_pthread_setcanceltype, pthread_setcanceltype);
-__weak_reference(_pthread_testcancel, pthread_testcancel);
+__weak_reference(_thr_cancel, pthread_cancel);
+__weak_reference(_thr_cancel, _pthread_cancel);
+__weak_reference(_thr_setcancelstate, pthread_setcancelstate);
+__weak_reference(_thr_setcancelstate, _pthread_setcancelstate);
+__weak_reference(_thr_setcanceltype, pthread_setcanceltype);
+__weak_reference(_thr_setcanceltype, _pthread_setcanceltype);
+__weak_reference(_Tthr_testcancel, pthread_testcancel);
+__weak_reference(_Tthr_testcancel, _pthread_testcancel);
 
 static inline void
 testcancel(struct pthread *curthread)
@@ -55,7 +59,7 @@ _thr_testcancel(struct pthread *curthread)
 }
 
 int
-_pthread_cancel(pthread_t pthread)
+_thr_cancel(pthread_t pthread)
 {
 	struct pthread *curthread = _get_curthread();
 	int ret;
@@ -77,7 +81,7 @@ _pthread_cancel(pthread_t pthread)
 }
 
 int
-_pthread_setcancelstate(int state, int *oldstate)
+_thr_setcancelstate(int state, int *oldstate)
 {
 	struct pthread *curthread = _get_curthread();
 	int oldval;
@@ -104,7 +108,7 @@ _pthread_setcancelstate(int state, int *oldstate)
 }
 
 int
-_pthread_setcanceltype(int type, int *oldtype)
+_thr_setcanceltype(int type, int *oldtype)
 {
 	struct pthread	*curthread = _get_curthread();
 	int oldval;
@@ -130,7 +134,7 @@ _pthread_setcanceltype(int type, int *oldtype)
 }
 
 void
-_pthread_testcancel(void)
+_Tthr_testcancel(void)
 {
 	struct pthread *curthread;
 

Modified: head/lib/libthr/thread/thr_clean.c
==============================================================================
--- head/lib/libthr/thread/thr_clean.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_clean.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -46,12 +46,18 @@ __FBSDID("$FreeBSD$");
 #undef pthread_cleanup_pop
 
 /* old binary compatible interfaces */
-__weak_reference(_pthread_cleanup_push, pthread_cleanup_push);
-__weak_reference(_pthread_cleanup_pop, pthread_cleanup_pop);
+__weak_reference(_thr_cleanup_pop, pthread_cleanup_pop);
+__weak_reference(_thr_cleanup_pop, _pthread_cleanup_pop);
+__weak_reference(_thr_cleanup_push, pthread_cleanup_push);
+__weak_reference(_thr_cleanup_push, _pthread_cleanup_push);
 
+/* help static linking when libc symbols have preference */
+__weak_reference(__thr_cleanup_push_imp, __pthread_cleanup_push_imp);
+__weak_reference(__thr_cleanup_pop_imp, __pthread_cleanup_pop_imp);
+
 void
-__pthread_cleanup_push_imp(void (*routine)(void *), void *arg,
-	struct _pthread_cleanup_info *info)
+__thr_cleanup_push_imp(void (*routine)(void *), void *arg,
+    struct _pthread_cleanup_info *info)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *newbuf;
@@ -65,7 +71,7 @@ __pthread_cleanup_push_imp(void (*routine)(void *), vo
 }
 
 void
-__pthread_cleanup_pop_imp(int execute)
+__thr_cleanup_pop_imp(int execute)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *old;
@@ -80,7 +86,7 @@ __pthread_cleanup_pop_imp(int execute)
 }
 
 void
-_pthread_cleanup_push(void (*routine) (void *), void *arg)
+_thr_cleanup_push(void (*routine)(void *), void *arg)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *newbuf;
@@ -98,7 +104,7 @@ _pthread_cleanup_push(void (*routine) (void *), void *
 }
 
 void
-_pthread_cleanup_pop(int execute)
+_thr_cleanup_pop(int execute)
 {
 	__pthread_cleanup_pop_imp(execute);
 }

Modified: head/lib/libthr/thread/thr_cond.c
==============================================================================
--- head/lib/libthr/thread/thr_cond.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_cond.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -49,7 +49,6 @@ _Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZ
 /*
  * Prototypes
  */
-int	__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
 int	__pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 		       const struct timespec * abstime);
 static int cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
@@ -63,14 +62,19 @@ static int cond_broadcast_common(pthread_cond_t *cond)
  * versions are not and are provided for libc internal usage (which
  * shouldn't introduce cancellation points).
  */
-__weak_reference(__pthread_cond_wait, pthread_cond_wait);
+__weak_reference(__thr_cond_wait, pthread_cond_wait);
+__weak_reference(__thr_cond_wait, __pthread_cond_wait);
+__weak_reference(_thr_cond_wait, _pthread_cond_wait);
 __weak_reference(__pthread_cond_timedwait, pthread_cond_timedwait);
+__weak_reference(_thr_cond_init, pthread_cond_init);
+__weak_reference(_thr_cond_init, _pthread_cond_init);
+__weak_reference(_thr_cond_destroy, pthread_cond_destroy);
+__weak_reference(_thr_cond_destroy, _pthread_cond_destroy);
+__weak_reference(_thr_cond_signal, pthread_cond_signal);
+__weak_reference(_thr_cond_signal, _pthread_cond_signal);
+__weak_reference(_thr_cond_broadcast, pthread_cond_broadcast);
+__weak_reference(_thr_cond_broadcast, _pthread_cond_broadcast);
 
-__weak_reference(_pthread_cond_init, pthread_cond_init);
-__weak_reference(_pthread_cond_destroy, pthread_cond_destroy);
-__weak_reference(_pthread_cond_signal, pthread_cond_signal);
-__weak_reference(_pthread_cond_broadcast, pthread_cond_broadcast);
-
 #define CV_PSHARED(cvp)	(((cvp)->kcond.c_flags & USYNC_PROCESS_SHARED) != 0)
 
 static void
@@ -149,7 +153,7 @@ init_static(struct pthread *thread, pthread_cond_t *co
 	}
 
 int
-_pthread_cond_init(pthread_cond_t * __restrict cond,
+_thr_cond_init(pthread_cond_t * __restrict cond,
     const pthread_condattr_t * __restrict cond_attr)
 {
 
@@ -158,7 +162,7 @@ _pthread_cond_init(pthread_cond_t * __restrict cond,
 }
 
 int
-_pthread_cond_destroy(pthread_cond_t *cond)
+_thr_cond_destroy(pthread_cond_t *cond)
 {
 	struct pthread_cond *cvp;
 	int error;
@@ -377,14 +381,14 @@ cond_wait_common(pthread_cond_t *cond, pthread_mutex_t
 }
 
 int
-_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+_thr_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 {
 
 	return (cond_wait_common(cond, mutex, NULL, 0));
 }
 
 int
-__pthread_cond_wait(pthread_cond_t * __restrict cond,
+__thr_cond_wait(pthread_cond_t * __restrict cond,
     pthread_mutex_t * __restrict mutex)
 {
 
@@ -392,7 +396,7 @@ __pthread_cond_wait(pthread_cond_t * __restrict cond,
 }
 
 int
-_pthread_cond_timedwait(pthread_cond_t * __restrict cond,
+_thr_cond_timedwait(pthread_cond_t * __restrict cond,
     pthread_mutex_t * __restrict mutex,
     const struct timespec * __restrict abstime)
 {
@@ -541,14 +545,14 @@ cond_broadcast_common(pthread_cond_t *cond)
 }
 
 int
-_pthread_cond_signal(pthread_cond_t * cond)
+_thr_cond_signal(pthread_cond_t * cond)
 {
 
 	return (cond_signal_common(cond));
 }
 
 int
-_pthread_cond_broadcast(pthread_cond_t * cond)
+_thr_cond_broadcast(pthread_cond_t * cond)
 {
 
 	return (cond_broadcast_common(cond));

Modified: head/lib/libthr/thread/thr_detach.c
==============================================================================
--- head/lib/libthr/thread/thr_detach.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_detach.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -38,10 +38,11 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_detach, pthread_detach);
+__weak_reference(_thr_detach, pthread_detach);
+__weak_reference(_thr_detach, _pthread_detach);
 
 int
-_pthread_detach(pthread_t pthread)
+_thr_detach(pthread_t pthread)
 {
 	struct pthread *curthread = _get_curthread();
 	int rval;

Modified: head/lib/libthr/thread/thr_equal.c
==============================================================================
--- head/lib/libthr/thread/thr_equal.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_equal.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -37,10 +37,11 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "thr_private.h"
 
-__weak_reference(_pthread_equal, pthread_equal);
+__weak_reference(_thr_equal, pthread_equal);
+__weak_reference(_thr_equal, _pthread_equal);
 
 int
-_pthread_equal(pthread_t t1, pthread_t t2)
+_thr_equal(pthread_t t1, pthread_t t2)
 {
 	/* Compare the two thread pointers: */
 	return (t1 == t2);

Modified: head/lib/libthr/thread/thr_exit.c
==============================================================================
--- head/lib/libthr/thread/thr_exit.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_exit.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -50,7 +50,8 @@ __FBSDID("$FreeBSD$");
 
 static void	exit_thread(void) __dead2;
 
-__weak_reference(_pthread_exit, pthread_exit);
+__weak_reference(_Tthr_exit, pthread_exit);
+__weak_reference(_Tthr_exit, _pthread_exit);
 
 #ifdef _PTHREAD_FORCED_UNWIND
 static int message_printed;
@@ -203,7 +204,7 @@ _thread_exit(const char *fname, int lineno, const char
 }
 
 void
-_pthread_exit(void *status)
+_Tthr_exit(void *status)
 {
 	_pthread_exit_mask(status, NULL);
 }

Modified: head/lib/libthr/thread/thr_fork.c
==============================================================================
--- head/lib/libthr/thread/thr_fork.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_fork.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -75,10 +75,11 @@ __FBSDID("$FreeBSD$");
 #include "rtld_lock.h"
 #include "thr_private.h"
 
-__weak_reference(_pthread_atfork, pthread_atfork);
+__weak_reference(_thr_atfork, _pthread_atfork);
+__weak_reference(_thr_atfork, pthread_atfork);
 
 int
-_pthread_atfork(void (*prepare)(void), void (*parent)(void),
+_thr_atfork(void (*prepare)(void), void (*parent)(void),
     void (*child)(void))
 {
 	struct pthread *curthread;

Modified: head/lib/libthr/thread/thr_getthreadid_np.c
==============================================================================
--- head/lib/libthr/thread/thr_getthreadid_np.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_getthreadid_np.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -35,13 +35,14 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_getthreadid_np, pthread_getthreadid_np);
+__weak_reference(_thr_getthreadid_np, _pthread_getthreadid_np);
+__weak_reference(_thr_getthreadid_np, pthread_getthreadid_np);
 
 /*
  * Provide the equivelant to AIX pthread_getthreadid_np() function.
  */
 int
-_pthread_getthreadid_np(void)
+_thr_getthreadid_np(void)
 {
 	struct pthread *curthread;
 

Modified: head/lib/libthr/thread/thr_init.c
==============================================================================
--- head/lib/libthr/thread/thr_init.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_init.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -203,76 +203,74 @@ STATIC_LIB_REQUIRE(_thread_state_running);
 	(pthread_func_t)entry, (pthread_func_t)entry
 
 static pthread_func_t jmp_table[][2] = {
-	{DUAL_ENTRY(_pthread_atfork)},	/* PJT_ATFORK */
-	{DUAL_ENTRY(_pthread_attr_destroy)},	/* PJT_ATTR_DESTROY */
-	{DUAL_ENTRY(_pthread_attr_getdetachstate)},	/* PJT_ATTR_GETDETACHSTATE */
-	{DUAL_ENTRY(_pthread_attr_getguardsize)},	/* PJT_ATTR_GETGUARDSIZE */
-	{DUAL_ENTRY(_pthread_attr_getinheritsched)},	/* PJT_ATTR_GETINHERITSCHED */
-	{DUAL_ENTRY(_pthread_attr_getschedparam)},	/* PJT_ATTR_GETSCHEDPARAM */
-	{DUAL_ENTRY(_pthread_attr_getschedpolicy)},	/* PJT_ATTR_GETSCHEDPOLICY */
-	{DUAL_ENTRY(_pthread_attr_getscope)},	/* PJT_ATTR_GETSCOPE */
-	{DUAL_ENTRY(_pthread_attr_getstackaddr)},	/* PJT_ATTR_GETSTACKADDR */
-	{DUAL_ENTRY(_pthread_attr_getstacksize)},	/* PJT_ATTR_GETSTACKSIZE */
-	{DUAL_ENTRY(_pthread_attr_init)},	/* PJT_ATTR_INIT */
-	{DUAL_ENTRY(_pthread_attr_setdetachstate)},	/* PJT_ATTR_SETDETACHSTATE */
-	{DUAL_ENTRY(_pthread_attr_setguardsize)},	/* PJT_ATTR_SETGUARDSIZE */
-	{DUAL_ENTRY(_pthread_attr_setinheritsched)},	/* PJT_ATTR_SETINHERITSCHED */
-	{DUAL_ENTRY(_pthread_attr_setschedparam)},	/* PJT_ATTR_SETSCHEDPARAM */
-	{DUAL_ENTRY(_pthread_attr_setschedpolicy)},	/* PJT_ATTR_SETSCHEDPOLICY */
-	{DUAL_ENTRY(_pthread_attr_setscope)},	/* PJT_ATTR_SETSCOPE */
-	{DUAL_ENTRY(_pthread_attr_setstackaddr)},	/* PJT_ATTR_SETSTACKADDR */
-	{DUAL_ENTRY(_pthread_attr_setstacksize)},	/* PJT_ATTR_SETSTACKSIZE */
-	{DUAL_ENTRY(_pthread_cancel)},	/* PJT_CANCEL */
-	{DUAL_ENTRY(_pthread_cleanup_pop)},	/* PJT_CLEANUP_POP */
-	{DUAL_ENTRY(_pthread_cleanup_push)},	/* PJT_CLEANUP_PUSH */
-	{DUAL_ENTRY(_pthread_cond_broadcast)},	/* PJT_COND_BROADCAST */
-	{DUAL_ENTRY(_pthread_cond_destroy)},	/* PJT_COND_DESTROY */
-	{DUAL_ENTRY(_pthread_cond_init)},	/* PJT_COND_INIT */
-	{DUAL_ENTRY(_pthread_cond_signal)},	/* PJT_COND_SIGNAL */
-	{DUAL_ENTRY(_pthread_cond_timedwait)},	/* PJT_COND_TIMEDWAIT */
-	{(pthread_func_t)__pthread_cond_wait,
-	 (pthread_func_t)_pthread_cond_wait},	/* PJT_COND_WAIT */
-	{DUAL_ENTRY(_pthread_detach)},	/* PJT_DETACH */
-	{DUAL_ENTRY(_pthread_equal)},	/* PJT_EQUAL */
-	{DUAL_ENTRY(_pthread_exit)},	/* PJT_EXIT */
-	{DUAL_ENTRY(_pthread_getspecific)},	/* PJT_GETSPECIFIC */
-	{DUAL_ENTRY(_pthread_join)},	/* PJT_JOIN */
-	{DUAL_ENTRY(_pthread_key_create)},	/* PJT_KEY_CREATE */
-	{DUAL_ENTRY(_pthread_key_delete)},	/* PJT_KEY_DELETE*/
-	{DUAL_ENTRY(_pthread_kill)},	/* PJT_KILL */
-	{DUAL_ENTRY(_pthread_main_np)},		/* PJT_MAIN_NP */
-	{DUAL_ENTRY(_pthread_mutexattr_destroy)}, /* PJT_MUTEXATTR_DESTROY */
-	{DUAL_ENTRY(_pthread_mutexattr_init)},	/* PJT_MUTEXATTR_INIT */
-	{DUAL_ENTRY(_pthread_mutexattr_settype)}, /* PJT_MUTEXATTR_SETTYPE */
-	{DUAL_ENTRY(_pthread_mutex_destroy)},	/* PJT_MUTEX_DESTROY */
-	{DUAL_ENTRY(_pthread_mutex_init)},	/* PJT_MUTEX_INIT */
-	{(pthread_func_t)__pthread_mutex_lock,
-	 (pthread_func_t)_pthread_mutex_lock},	/* PJT_MUTEX_LOCK */
-	{(pthread_func_t)__pthread_mutex_trylock,
-	 (pthread_func_t)_pthread_mutex_trylock},/* PJT_MUTEX_TRYLOCK */
-	{DUAL_ENTRY(_pthread_mutex_unlock)},	/* PJT_MUTEX_UNLOCK */
-	{DUAL_ENTRY(_pthread_once)},		/* PJT_ONCE */
-	{DUAL_ENTRY(_pthread_rwlock_destroy)},	/* PJT_RWLOCK_DESTROY */
-	{DUAL_ENTRY(_pthread_rwlock_init)},	/* PJT_RWLOCK_INIT */
-	{DUAL_ENTRY(_pthread_rwlock_rdlock)},	/* PJT_RWLOCK_RDLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_tryrdlock)},/* PJT_RWLOCK_TRYRDLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_trywrlock)},/* PJT_RWLOCK_TRYWRLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_unlock)},	/* PJT_RWLOCK_UNLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_wrlock)},	/* PJT_RWLOCK_WRLOCK */
-	{DUAL_ENTRY(_pthread_self)},		/* PJT_SELF */
-	{DUAL_ENTRY(_pthread_setcancelstate)},	/* PJT_SETCANCELSTATE */
-	{DUAL_ENTRY(_pthread_setcanceltype)},	/* PJT_SETCANCELTYPE */
-	{DUAL_ENTRY(_pthread_setspecific)},	/* PJT_SETSPECIFIC */
-	{DUAL_ENTRY(_pthread_sigmask)},		/* PJT_SIGMASK */
-	{DUAL_ENTRY(_pthread_testcancel)},	/* PJT_TESTCANCEL */
-	{DUAL_ENTRY(__pthread_cleanup_pop_imp)},/* PJT_CLEANUP_POP_IMP */
-	{DUAL_ENTRY(__pthread_cleanup_push_imp)},/* PJT_CLEANUP_PUSH_IMP */
-	{DUAL_ENTRY(_pthread_cancel_enter)},	/* PJT_CANCEL_ENTER */
-	{DUAL_ENTRY(_pthread_cancel_leave)},	/* PJT_CANCEL_LEAVE */
-	{DUAL_ENTRY(_pthread_mutex_consistent)},/* PJT_MUTEX_CONSISTENT */
-	{DUAL_ENTRY(_pthread_mutexattr_getrobust)},/* PJT_MUTEXATTR_GETROBUST */
-	{DUAL_ENTRY(_pthread_mutexattr_setrobust)},/* PJT_MUTEXATTR_SETROBUST */
-	{DUAL_ENTRY(_pthread_getthreadid_np)},	/* PJT_GETTHREADID_NP */
+	[PJT_ATFORK] = {DUAL_ENTRY(_thr_atfork)},
+	[PJT_ATTR_DESTROY] = {DUAL_ENTRY(_thr_attr_destroy)},
+	[PJT_ATTR_GETDETACHSTATE] = {DUAL_ENTRY(_thr_attr_getdetachstate)},
+	[PJT_ATTR_GETGUARDSIZE] = {DUAL_ENTRY(_thr_attr_getguardsize)},
+	[PJT_ATTR_GETINHERITSCHED] = {DUAL_ENTRY(_thr_attr_getinheritsched)},
+	[PJT_ATTR_GETSCHEDPARAM] = {DUAL_ENTRY(_thr_attr_getschedparam)},
+	[PJT_ATTR_GETSCHEDPOLICY] = {DUAL_ENTRY(_thr_attr_getschedpolicy)},
+	[PJT_ATTR_GETSCOPE] = {DUAL_ENTRY(_thr_attr_getscope)},
+	[PJT_ATTR_GETSTACKADDR] = {DUAL_ENTRY(_thr_attr_getstackaddr)},
+	[PJT_ATTR_GETSTACKSIZE] = {DUAL_ENTRY(_thr_attr_getstacksize)},
+	[PJT_ATTR_INIT] = {DUAL_ENTRY(_thr_attr_init)},
+	[PJT_ATTR_SETDETACHSTATE] = {DUAL_ENTRY(_thr_attr_setdetachstate)},
+	[PJT_ATTR_SETGUARDSIZE] = {DUAL_ENTRY(_thr_attr_setguardsize)},
+	[PJT_ATTR_SETINHERITSCHED] = {DUAL_ENTRY(_thr_attr_setinheritsched)},
+	[PJT_ATTR_SETSCHEDPARAM] = {DUAL_ENTRY(_thr_attr_setschedparam)},
+	[PJT_ATTR_SETSCHEDPOLICY] = {DUAL_ENTRY(_thr_attr_setschedpolicy)},
+	[PJT_ATTR_SETSCOPE] = {DUAL_ENTRY(_thr_attr_setscope)},
+	[PJT_ATTR_SETSTACKADDR] = {DUAL_ENTRY(_thr_attr_setstackaddr)},
+	[PJT_ATTR_SETSTACKSIZE] = {DUAL_ENTRY(_thr_attr_setstacksize)},
+	[PJT_CANCEL] = {DUAL_ENTRY(_thr_cancel)},
+	[PJT_CLEANUP_POP] = {DUAL_ENTRY(_thr_cleanup_pop)},
+	[PJT_CLEANUP_PUSH] = {DUAL_ENTRY(_thr_cleanup_push)},
+	[PJT_COND_BROADCAST] = {DUAL_ENTRY(_thr_cond_broadcast)},
+	[PJT_COND_DESTROY] = {DUAL_ENTRY(_thr_cond_destroy)},
+	[PJT_COND_INIT] = {DUAL_ENTRY(_thr_cond_init)},
+	[PJT_COND_SIGNAL] = {DUAL_ENTRY(_thr_cond_signal)},
+	[PJT_COND_TIMEDWAIT] = {DUAL_ENTRY(_thr_cond_timedwait)},
+	[PJT_COND_WAIT] = {(pthread_func_t)__thr_cond_wait,
+	    (pthread_func_t)_thr_cond_wait},
+	[PJT_DETACH] = {DUAL_ENTRY(_thr_detach)},
+	[PJT_EQUAL] = {DUAL_ENTRY(_thr_equal)},
+	[PJT_EXIT] = {DUAL_ENTRY(_Tthr_exit)},
+	[PJT_GETSPECIFIC] = {DUAL_ENTRY(_thr_getspecific)},
+	[PJT_JOIN] = {DUAL_ENTRY(_thr_join)},
+	[PJT_KEY_CREATE] = {DUAL_ENTRY(_thr_key_create)},
+	[PJT_KEY_DELETE] = {DUAL_ENTRY(_thr_key_delete)},
+	[PJT_KILL] = {DUAL_ENTRY(_Tthr_kill)},
+	[PJT_MAIN_NP] = {DUAL_ENTRY(_thr_main_np)},
+	[PJT_MUTEXATTR_DESTROY] = {DUAL_ENTRY(_thr_mutexattr_destroy)},
+	[PJT_MUTEXATTR_INIT] = {DUAL_ENTRY(_thr_mutexattr_init)},
+	[PJT_MUTEXATTR_SETTYPE] = {DUAL_ENTRY(_thr_mutexattr_settype)},
+	[PJT_MUTEX_DESTROY] = {DUAL_ENTRY(_thr_mutex_destroy)},
+	[PJT_MUTEX_INIT] = {DUAL_ENTRY(__Tthr_mutex_init)},
+	[PJT_MUTEX_LOCK] = {DUAL_ENTRY(__Tthr_mutex_lock)},
+	[PJT_MUTEX_TRYLOCK] = {DUAL_ENTRY(__Tthr_mutex_trylock)},
+	[PJT_MUTEX_UNLOCK] = {DUAL_ENTRY(_thr_mutex_unlock)},
+	[PJT_ONCE] = {DUAL_ENTRY(_thr_once)},
+	[PJT_RWLOCK_DESTROY] = {DUAL_ENTRY(_thr_rwlock_destroy)},
+	[PJT_RWLOCK_INIT] = {DUAL_ENTRY(_thr_rwlock_init)},
+	[PJT_RWLOCK_RDLOCK] = {DUAL_ENTRY(_Tthr_rwlock_rdlock)},
+	[PJT_RWLOCK_TRYRDLOCK] = {DUAL_ENTRY(_Tthr_rwlock_tryrdlock)},
+	[PJT_RWLOCK_TRYWRLOCK] = {DUAL_ENTRY(_Tthr_rwlock_trywrlock)},
+	[PJT_RWLOCK_UNLOCK] = {DUAL_ENTRY(_Tthr_rwlock_unlock)},
+	[PJT_RWLOCK_WRLOCK] = {DUAL_ENTRY(_Tthr_rwlock_wrlock)},
+	[PJT_SELF] = {DUAL_ENTRY(_Tthr_self)},
+	[PJT_SETCANCELSTATE] = {DUAL_ENTRY(_thr_setcancelstate)},
+	[PJT_SETCANCELTYPE] = {DUAL_ENTRY(_thr_setcanceltype)},
+	[PJT_SETSPECIFIC] = {DUAL_ENTRY(_thr_setspecific)},
+	[PJT_SIGMASK] = {DUAL_ENTRY(_thr_sigmask)},
+	[PJT_TESTCANCEL] = {DUAL_ENTRY(_Tthr_testcancel)},
+	[PJT_CLEANUP_POP_IMP] = {DUAL_ENTRY(__thr_cleanup_pop_imp)},
+	[PJT_CLEANUP_PUSH_IMP] = {DUAL_ENTRY(__thr_cleanup_push_imp)},
+	[PJT_CANCEL_ENTER] = {DUAL_ENTRY(_thr_cancel_enter)},
+	[PJT_CANCEL_LEAVE] = {DUAL_ENTRY(_thr_cancel_leave)},
+	[PJT_MUTEX_CONSISTENT] = {DUAL_ENTRY(_Tthr_mutex_consistent)},
+	[PJT_MUTEXATTR_GETROBUST] = {DUAL_ENTRY(_thr_mutexattr_getrobust)},
+	[PJT_MUTEXATTR_SETROBUST] = {DUAL_ENTRY(_thr_mutexattr_setrobust)},
+	[PJT_GETTHREADID_NP] = {DUAL_ENTRY(_thr_getthreadid_np)},
 };
 
 static int init_once = 0;

Modified: head/lib/libthr/thread/thr_join.c
==============================================================================
--- head/lib/libthr/thread/thr_join.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_join.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -40,7 +40,8 @@ int	_pthread_timedjoin_np(pthread_t pthread, void **th
 	const struct timespec *abstime);
 static int join_common(pthread_t, void **, const struct timespec *);
 
-__weak_reference(_pthread_join, pthread_join);
+__weak_reference(_thr_join, pthread_join);
+__weak_reference(_thr_join, _pthread_join);
 __weak_reference(_pthread_timedjoin_np, pthread_timedjoin_np);
 
 static void backout_join(void *arg)
@@ -54,7 +55,7 @@ static void backout_join(void *arg)
 }
 
 int
-_pthread_join(pthread_t pthread, void **thread_return)
+_thr_join(pthread_t pthread, void **thread_return)
 {
 	return (join_common(pthread, thread_return, NULL));
 }

Modified: head/lib/libthr/thread/thr_kill.c
==============================================================================
--- head/lib/libthr/thread/thr_kill.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_kill.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -40,10 +40,11 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_kill, pthread_kill);
+__weak_reference(_Tthr_kill, _pthread_kill);
+__weak_reference(_Tthr_kill, pthread_kill);
 
 int
-_pthread_kill(pthread_t pthread, int sig)
+_Tthr_kill(pthread_t pthread, int sig)
 {
 	struct pthread *curthread;
 	int ret;

Modified: head/lib/libthr/thread/thr_main_np.c
==============================================================================
--- head/lib/libthr/thread/thr_main_np.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_main_np.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -37,13 +37,14 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_main_np, pthread_main_np);
+__weak_reference(_thr_main_np, pthread_main_np);
+__weak_reference(_thr_main_np, _pthread_main_np);
 
 /*
  * Provide the equivalent to Solaris thr_main() function.
  */
 int
-_pthread_main_np(void)
+_thr_main_np(void)
 {
 
 	if (!_thr_initial)

Modified: head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- head/lib/libthr/thread/thr_mutex.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_mutex.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -65,11 +65,6 @@ _Static_assert(sizeof(struct pthread_mutex) <= PAGE_SI
 /*
  * Prototypes
  */
-int	__pthread_mutex_consistent(pthread_mutex_t *mutex);
-int	__pthread_mutex_init(pthread_mutex_t * __restrict mutex,
-		const pthread_mutexattr_t * __restrict mutex_attr);
-int	__pthread_mutex_trylock(pthread_mutex_t *mutex);
-int	__pthread_mutex_lock(pthread_mutex_t *mutex);
 int	__pthread_mutex_timedlock(pthread_mutex_t * __restrict mutex,
 		const struct timespec * __restrict abstime);
 int	_pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count);
@@ -90,21 +85,27 @@ static int	mutex_qidx(struct pthread_mutex *m);
 static bool	is_robust_mutex(struct pthread_mutex *m);
 static bool	is_pshared_mutex(struct pthread_mutex *m);
 
-__weak_reference(__pthread_mutex_init, pthread_mutex_init);
-__strong_reference(__pthread_mutex_init, _pthread_mutex_init);
-__weak_reference(__pthread_mutex_lock, pthread_mutex_lock);
-__strong_reference(__pthread_mutex_lock, _pthread_mutex_lock);
+__weak_reference(__Tthr_mutex_init, pthread_mutex_init);
+__weak_reference(__Tthr_mutex_init, __pthread_mutex_init);
+__strong_reference(__Tthr_mutex_init, _pthread_mutex_init);
+__weak_reference(__Tthr_mutex_lock, pthread_mutex_lock);
+__weak_reference(__Tthr_mutex_lock, __pthread_mutex_lock);
+__strong_reference(__Tthr_mutex_lock, _pthread_mutex_lock);
 __weak_reference(__pthread_mutex_timedlock, pthread_mutex_timedlock);
 __strong_reference(__pthread_mutex_timedlock, _pthread_mutex_timedlock);
-__weak_reference(__pthread_mutex_trylock, pthread_mutex_trylock);
-__strong_reference(__pthread_mutex_trylock, _pthread_mutex_trylock);
-__weak_reference(_pthread_mutex_consistent, pthread_mutex_consistent);
-__strong_reference(_pthread_mutex_consistent, __pthread_mutex_consistent);
+__weak_reference(__Tthr_mutex_trylock, pthread_mutex_trylock);
+__weak_reference(__Tthr_mutex_trylock, __pthread_mutex_trylock);
+__strong_reference(__Tthr_mutex_trylock, _pthread_mutex_trylock);
+__weak_reference(_Tthr_mutex_consistent, pthread_mutex_consistent);
+__weak_reference(_Tthr_mutex_consistent, _pthread_mutex_consistent);
+__strong_reference(_Tthr_mutex_consistent, __pthread_mutex_consistent);
 
 /* Single underscore versions provided for libc internal usage: */
 /* No difference between libc and application usage of these: */
-__weak_reference(_pthread_mutex_destroy, pthread_mutex_destroy);
-__weak_reference(_pthread_mutex_unlock, pthread_mutex_unlock);
+__weak_reference(_thr_mutex_destroy, pthread_mutex_destroy);
+__weak_reference(_thr_mutex_destroy, _pthread_mutex_destroy);
+__weak_reference(_thr_mutex_unlock, pthread_mutex_unlock);
+__weak_reference(_thr_mutex_unlock, _pthread_mutex_unlock);
 
 __weak_reference(_pthread_mutex_getprioceiling, pthread_mutex_getprioceiling);
 __weak_reference(_pthread_mutex_setprioceiling, pthread_mutex_setprioceiling);
@@ -377,7 +378,7 @@ shared_mutex_init(struct pthread_mutex *pmtx, const st
 }
 
 int
-__pthread_mutex_init(pthread_mutex_t * __restrict mutex,
+__Tthr_mutex_init(pthread_mutex_t * __restrict mutex,
     const pthread_mutexattr_t * __restrict mutex_attr)
 {
 	struct pthread_mutex *pmtx;
@@ -459,7 +460,7 @@ _mutex_fork(struct pthread *curthread)
 }
 
 int
-_pthread_mutex_destroy(pthread_mutex_t *mutex)
+_thr_mutex_destroy(pthread_mutex_t *mutex)
 {
 	pthread_mutex_t m, m1;
 	int ret;
@@ -608,7 +609,7 @@ check_and_init_mutex(pthread_mutex_t *mutex, struct pt
 }
 
 int
-__pthread_mutex_trylock(pthread_mutex_t *mutex)
+__Tthr_mutex_trylock(pthread_mutex_t *mutex)
 {
 	struct pthread *curthread;
 	struct pthread_mutex *m;
@@ -737,7 +738,7 @@ mutex_lock_common(struct pthread_mutex *m, const struc
 }
 
 int
-__pthread_mutex_lock(pthread_mutex_t *mutex)
+__Tthr_mutex_lock(pthread_mutex_t *mutex)
 {
 	struct pthread_mutex *m;
 	int ret;
@@ -764,7 +765,7 @@ __pthread_mutex_timedlock(pthread_mutex_t * __restrict
 }
 
 int
-_pthread_mutex_unlock(pthread_mutex_t *mutex)
+_thr_mutex_unlock(pthread_mutex_t *mutex)
 {
 	struct pthread_mutex *mp;
 
@@ -1167,7 +1168,7 @@ _mutex_owned(struct pthread *curthread, const struct p
 }
 
 int
-_pthread_mutex_consistent(pthread_mutex_t *mutex)
+_Tthr_mutex_consistent(pthread_mutex_t *mutex)
 {
 	struct pthread_mutex *m;
 	struct pthread *curthread;

Modified: head/lib/libthr/thread/thr_mutexattr.c
==============================================================================
--- head/lib/libthr/thread/thr_mutexattr.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_mutexattr.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -72,12 +72,15 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_mutexattr_init, pthread_mutexattr_init);
+__weak_reference(_thr_mutexattr_init, pthread_mutexattr_init);
+__weak_reference(_thr_mutexattr_init, _pthread_mutexattr_init);
 __weak_reference(_pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);
 __weak_reference(_pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);
 __weak_reference(_pthread_mutexattr_gettype, pthread_mutexattr_gettype);
-__weak_reference(_pthread_mutexattr_settype, pthread_mutexattr_settype);
-__weak_reference(_pthread_mutexattr_destroy, pthread_mutexattr_destroy);
+__weak_reference(_thr_mutexattr_settype, pthread_mutexattr_settype);
+__weak_reference(_thr_mutexattr_settype, _pthread_mutexattr_settype);
+__weak_reference(_thr_mutexattr_destroy, pthread_mutexattr_destroy);
+__weak_reference(_thr_mutexattr_destroy, _pthread_mutexattr_destroy);
 __weak_reference(_pthread_mutexattr_getpshared, pthread_mutexattr_getpshared);
 __weak_reference(_pthread_mutexattr_setpshared, pthread_mutexattr_setpshared);
 __weak_reference(_pthread_mutexattr_getprotocol, pthread_mutexattr_getprotocol);
@@ -86,11 +89,13 @@ __weak_reference(_pthread_mutexattr_getprioceiling,
     pthread_mutexattr_getprioceiling);
 __weak_reference(_pthread_mutexattr_setprioceiling,
     pthread_mutexattr_setprioceiling);
-__weak_reference(_pthread_mutexattr_getrobust, pthread_mutexattr_getrobust);
-__weak_reference(_pthread_mutexattr_setrobust, pthread_mutexattr_setrobust);
+__weak_reference(_thr_mutexattr_getrobust, pthread_mutexattr_getrobust);
+__weak_reference(_thr_mutexattr_getrobust, _pthread_mutexattr_getrobust);
+__weak_reference(_thr_mutexattr_setrobust, pthread_mutexattr_setrobust);
+__weak_reference(_thr_mutexattr_setrobust, _pthread_mutexattr_setrobust);
 
 int
-_pthread_mutexattr_init(pthread_mutexattr_t *attr)
+_thr_mutexattr_init(pthread_mutexattr_t *attr)
 {
 	int ret;
 	pthread_mutexattr_t pattr;
@@ -136,7 +141,7 @@ _pthread_mutexattr_getkind_np(pthread_mutexattr_t attr
 }
 
 int
-_pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
+_thr_mutexattr_settype(pthread_mutexattr_t *attr, int type)
 {
 	int	ret;
 
@@ -166,7 +171,7 @@ _pthread_mutexattr_gettype(const pthread_mutexattr_t *
 }
 
 int
-_pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
+_thr_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
 	int	ret;
 	if (attr == NULL || *attr == NULL) {
@@ -263,7 +268,7 @@ _pthread_mutexattr_setprioceiling(pthread_mutexattr_t 
 }
 
 int
-_pthread_mutexattr_getrobust(pthread_mutexattr_t *mattr, int *robust)
+_thr_mutexattr_getrobust(pthread_mutexattr_t *mattr, int *robust)
 {
 	int ret;
 
@@ -277,7 +282,7 @@ _pthread_mutexattr_getrobust(pthread_mutexattr_t *matt
 }
 
 int
-_pthread_mutexattr_setrobust(pthread_mutexattr_t *mattr, int robust)
+_thr_mutexattr_setrobust(pthread_mutexattr_t *mattr, int robust)
 {
 	int ret;
 

Modified: head/lib/libthr/thread/thr_once.c
==============================================================================
--- head/lib/libthr/thread/thr_once.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_once.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -35,7 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_once, pthread_once);
+__weak_reference(_thr_once, pthread_once);
+__weak_reference(_thr_once, _pthread_once);
 
 #define ONCE_NEVER_DONE		PTHREAD_NEEDS_INIT
 #define ONCE_DONE		PTHREAD_DONE_INIT
@@ -63,7 +64,7 @@ once_cancel_handler(void *arg)
 }
 
 int
-_pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
+_thr_once(pthread_once_t *once_control, void (*init_routine)(void))
 {
 	struct pthread *curthread;
 	int state;

Modified: head/lib/libthr/thread/thr_private.h
==============================================================================
--- head/lib/libthr/thread/thr_private.h	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_private.h	Wed Jul 31 19:27:20 2019	(r350481)
@@ -1013,6 +1013,86 @@ void __thr_malloc_init(void);
 void __thr_malloc_prefork(struct pthread *curthread);
 void __thr_malloc_postfork(struct pthread *curthread);
 
+int _thr_join(pthread_t, void **);
+int _Tthr_kill(pthread_t, int);
+int _thr_getthreadid_np(void);
+void __thr_cleanup_push_imp(void (*)(void *), void *,
+    struct _pthread_cleanup_info *);
+void __thr_cleanup_pop_imp(int);
+void _thr_cleanup_push(void (*)(void *), void *);
+void _thr_cleanup_pop(int);
+void _thr_cancel_enter(struct pthread *);
+void _thr_cancel_leave(struct pthread *, int);
+void _Tthr_testcancel(void);
+int _thr_cancel(pthread_t);
+int _thr_atfork(void (*)(void), void (*)(void), void (*)(void));
+int _thr_attr_destroy(pthread_attr_t *);
+int _thr_attr_get_np(pthread_t, pthread_attr_t *);
+int _thr_attr_getdetachstate(const pthread_attr_t *, int *);
+int _thr_attr_getguardsize(const pthread_attr_t * __restrict,
+    size_t * __restrict);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907311927.x6VJRKah057978>