diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c index 0290c089be5c..833cfbbbc22d 100644 --- a/lib/libthr/thread/thr_attr.c +++ b/lib/libthr/thread/thr_attr.c @@ -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 *dstattr) 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 *attr, int *detachstate) 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 * __restrict attr, 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 * __restrict attr, 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 * __restrict attr, 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 * __restrict attr, 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_getstack); 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 * __restrict attr, 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, void **stackaddr) 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 * __restrict attr, 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 detachstate) 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_t guardsize) 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, int sched_inherit) 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 * __restrict attr, 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 policy) 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 *stackaddr, 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 *stackaddr) 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; diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c index fdcdb2c1051f..0d6e393310f3 100644 --- a/lib/libthr/thread/thr_cancel.c +++ b/lib/libthr/thread/thr_cancel.c @@ -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; diff --git a/lib/libthr/thread/thr_clean.c b/lib/libthr/thread/thr_clean.c index 5a93d94a7e5a..4c73c486eeff 100644 --- a/lib/libthr/thread/thr_clean.c +++ b/lib/libthr/thread/thr_clean.c @@ -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 *), void *arg, } 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 *arg) } void -_pthread_cleanup_pop(int execute) +_thr_cleanup_pop(int execute) { __pthread_cleanup_pop_imp(execute); } diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c index 35964d1c441f..9eba3dd437f0 100644 --- a/lib/libthr/thread/thr_cond.c +++ b/lib/libthr/thread/thr_cond.c @@ -49,7 +49,6 @@ _Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZE, /* * 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,13 +62,18 @@ 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(_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); +__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); #define CV_PSHARED(cvp) (((cvp)->kcond.c_flags & USYNC_PROCESS_SHARED) != 0) @@ -149,7 +153,7 @@ init_static(struct pthread *thread, pthread_cond_t *cond) } 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 *mutex, } 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)); diff --git a/lib/libthr/thread/thr_detach.c b/lib/libthr/thread/thr_detach.c index feac319d0df8..2618f637b5df 100644 --- a/lib/libthr/thread/thr_detach.c +++ b/lib/libthr/thread/thr_detach.c @@ -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; diff --git a/lib/libthr/thread/thr_equal.c b/lib/libthr/thread/thr_equal.c index 8baed3b75c3f..69aa6bff8922 100644 --- a/lib/libthr/thread/thr_equal.c +++ b/lib/libthr/thread/thr_equal.c @@ -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); diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index 5c5a6bd766a3..78497c4a206a 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -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 *msg) } void -_pthread_exit(void *status) +_Tthr_exit(void *status) { _pthread_exit_mask(status, NULL); } diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c index 2e151618ffbc..7b6b47024c12 100644 --- a/lib/libthr/thread/thr_fork.c +++ b/lib/libthr/thread/thr_fork.c @@ -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; diff --git a/lib/libthr/thread/thr_getthreadid_np.c b/lib/libthr/thread/thr_getthreadid_np.c index 3011307861ae..9f522b79cb06 100644 --- a/lib/libthr/thread/thr_getthreadid_np.c +++ b/lib/libthr/thread/thr_getthreadid_np.c @@ -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; diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 7b043a38b1f2..914d51363bd7 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -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; diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c index f6136e479b52..640cd63b1a5e 100644 --- a/lib/libthr/thread/thr_join.c +++ b/lib/libthr/thread/thr_join.c @@ -40,7 +40,8 @@ int _pthread_timedjoin_np(pthread_t pthread, void **thread_return, 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)); } diff --git a/lib/libthr/thread/thr_kill.c b/lib/libthr/thread/thr_kill.c index 59b8b1567011..c96c1b3ecbaa 100644 --- a/lib/libthr/thread/thr_kill.c +++ b/lib/libthr/thread/thr_kill.c @@ -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; diff --git a/lib/libthr/thread/thr_main_np.c b/lib/libthr/thread/thr_main_np.c index 7ce54bc9f1f0..ff28d1d8a5ac 100644 --- a/lib/libthr/thread/thr_main_np.c +++ b/lib/libthr/thread/thr_main_np.c @@ -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) diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index 9dc38c723773..dc09f539add5 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -65,11 +65,6 @@ _Static_assert(sizeof(struct pthread_mutex) <= PAGE_SIZE, /* * 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 struct } 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 pthread_mutex **m) } 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 struct timespec *abstime, } 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 mutex, } 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 pthread_mutex *mp) } int -_pthread_mutex_consistent(pthread_mutex_t *mutex) +_Tthr_mutex_consistent(pthread_mutex_t *mutex) { struct pthread_mutex *m; struct pthread *curthread; diff --git a/lib/libthr/thread/thr_mutexattr.c b/lib/libthr/thread/thr_mutexattr.c index 8313728e5cfb..1f5d3b284af8 100644 --- a/lib/libthr/thread/thr_mutexattr.c +++ b/lib/libthr/thread/thr_mutexattr.c @@ -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 * __restrict attr, } 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 *mattr, int prioceiling) } 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 *mattr, int *robust) } int -_pthread_mutexattr_setrobust(pthread_mutexattr_t *mattr, int robust) +_thr_mutexattr_setrobust(pthread_mutexattr_t *mattr, int robust) { int ret; diff --git a/lib/libthr/thread/thr_once.c b/lib/libthr/thread/thr_once.c index 90778440b76e..6783d8f644f8 100644 --- a/lib/libthr/thread/thr_once.c +++ b/lib/libthr/thread/thr_once.c @@ -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; diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index a9720812d681..03985721384b 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -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); +int _thr_attr_getinheritsched(const pthread_attr_t * __restrict, + int * __restrict); +int _thr_attr_getschedparam(const pthread_attr_t * __restrict, + struct sched_param * __restrict); +int _thr_attr_getschedpolicy(const pthread_attr_t * __restrict, + int * __restrict); +int _thr_attr_getscope(const pthread_attr_t * __restrict, int * __restrict); +int _thr_attr_getstackaddr(const pthread_attr_t *, void **); +int _thr_attr_getstacksize(const pthread_attr_t * __restrict, + size_t * __restrict); +int _thr_attr_init(pthread_attr_t *); +int _thr_attr_setdetachstate(pthread_attr_t *, int); +int _thr_attr_setguardsize(pthread_attr_t *, size_t); +int _thr_attr_setinheritsched(pthread_attr_t *, int); +int _thr_attr_setschedparam(pthread_attr_t * __restrict, + const struct sched_param * __restrict); +int _thr_attr_setschedpolicy(pthread_attr_t *, int); +int _thr_attr_setscope(pthread_attr_t *, int); +int _thr_attr_setstackaddr(pthread_attr_t *, void *); +int _thr_attr_setstacksize(pthread_attr_t *, size_t); +int _thr_cond_init(pthread_cond_t * __restrict, + const pthread_condattr_t * __restrict); +int _thr_cond_destroy(pthread_cond_t *); +int _thr_cond_timedwait(pthread_cond_t * __restrict, + pthread_mutex_t * __restrict, const struct timespec * __restrict); +int _thr_cond_signal(pthread_cond_t * cond); +int _thr_cond_broadcast(pthread_cond_t * cond); +int __thr_cond_wait(pthread_cond_t *, pthread_mutex_t *); +int _thr_cond_wait(pthread_cond_t *, pthread_mutex_t *); +int _thr_detach(pthread_t); +int _thr_equal(pthread_t, pthread_t); +void _Tthr_exit(void *); +int _thr_key_create(pthread_key_t *, void (*)(void *)); +int _thr_key_delete(pthread_key_t); +int _thr_setspecific(pthread_key_t, const void *); +void *_thr_getspecific(pthread_key_t); +int _thr_setcancelstate(int, int *); +int _thr_setcanceltype(int, int *); +pthread_t _Tthr_self(void); +int _thr_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *); +int _thr_rwlock_destroy(pthread_rwlock_t *); +int _Tthr_rwlock_rdlock(pthread_rwlock_t *); +int _Tthr_rwlock_tryrdlock(pthread_rwlock_t *); +int _Tthr_rwlock_trywrlock(pthread_rwlock_t *); +int _Tthr_rwlock_wrlock(pthread_rwlock_t *); +int _Tthr_rwlock_unlock(pthread_rwlock_t *); +int _thr_once(pthread_once_t *, void (*)(void)); +int _thr_sigmask(int, const sigset_t *, sigset_t *); +int _thr_main_np(void); +int _thr_mutexattr_init(pthread_mutexattr_t *); +int _thr_mutexattr_destroy(pthread_mutexattr_t *); +int _thr_mutexattr_settype(pthread_mutexattr_t *, int); +int _thr_mutexattr_getrobust(pthread_mutexattr_t *, int *); +int _thr_mutexattr_setrobust(pthread_mutexattr_t *, int); +int __Tthr_mutex_init(pthread_mutex_t * __restrict, + const pthread_mutexattr_t * __restrict); +int _Tthr_mutex_consistent(pthread_mutex_t *); +int _thr_mutex_destroy(pthread_mutex_t *); +int _thr_mutex_unlock(pthread_mutex_t *); +int __Tthr_mutex_lock(pthread_mutex_t *); +int __Tthr_mutex_trylock(pthread_mutex_t *); + __END_DECLS __NULLABILITY_PRAGMA_POP diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c index 3eb837c0ff35..22c6c878b2a5 100644 --- a/lib/libthr/thread/thr_rwlock.c +++ b/lib/libthr/thread/thr_rwlock.c @@ -41,14 +41,21 @@ __FBSDID("$FreeBSD$"); _Static_assert(sizeof(struct pthread_rwlock) <= PAGE_SIZE, "pthread_rwlock is too large for off-page"); -__weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy); -__weak_reference(_pthread_rwlock_init, pthread_rwlock_init); -__weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock); +__weak_reference(_thr_rwlock_destroy, pthread_rwlock_destroy); +__weak_reference(_thr_rwlock_destroy, _pthread_rwlock_destroy); +__weak_reference(_thr_rwlock_init, pthread_rwlock_init); +__weak_reference(_thr_rwlock_init, _pthread_rwlock_init); +__weak_reference(_Tthr_rwlock_rdlock, pthread_rwlock_rdlock); +__weak_reference(_Tthr_rwlock_rdlock, _pthread_rwlock_rdlock); __weak_reference(_pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock); -__weak_reference(_pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock); -__weak_reference(_pthread_rwlock_trywrlock, pthread_rwlock_trywrlock); -__weak_reference(_pthread_rwlock_unlock, pthread_rwlock_unlock); -__weak_reference(_pthread_rwlock_wrlock, pthread_rwlock_wrlock); +__weak_reference(_Tthr_rwlock_tryrdlock, pthread_rwlock_tryrdlock); +__weak_reference(_Tthr_rwlock_tryrdlock, _pthread_rwlock_tryrdlock); +__weak_reference(_Tthr_rwlock_trywrlock, pthread_rwlock_trywrlock); +__weak_reference(_Tthr_rwlock_trywrlock, _pthread_rwlock_trywrlock); +__weak_reference(_Tthr_rwlock_unlock, pthread_rwlock_unlock); +__weak_reference(_Tthr_rwlock_unlock, _pthread_rwlock_unlock); +__weak_reference(_Tthr_rwlock_wrlock, pthread_rwlock_wrlock); +__weak_reference(_Tthr_rwlock_wrlock, _pthread_rwlock_wrlock); __weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock); static int init_static(struct pthread *thread, pthread_rwlock_t *rwlock); @@ -110,7 +117,7 @@ rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) } int -_pthread_rwlock_destroy (pthread_rwlock_t *rwlock) +_thr_rwlock_destroy(pthread_rwlock_t *rwlock) { pthread_rwlock_t prwlock; int ret; @@ -150,7 +157,7 @@ init_static(struct pthread *thread, pthread_rwlock_t *rwlock) } int -_pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) +_thr_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) { *rwlock = NULL; @@ -219,7 +226,7 @@ rwlock_rdlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime) } int -_pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) +_Tthr_rwlock_rdlock(pthread_rwlock_t *rwlock) { return (rwlock_rdlock_common(rwlock, NULL)); } @@ -232,7 +239,7 @@ _pthread_rwlock_timedrdlock(pthread_rwlock_t * __restrict rwlock, } int -_pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) +_Tthr_rwlock_tryrdlock(pthread_rwlock_t *rwlock) { struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; @@ -268,7 +275,7 @@ _pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) } int -_pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) +_Tthr_rwlock_trywrlock(pthread_rwlock_t *rwlock) { struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; @@ -285,7 +292,7 @@ _pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) } static int -rwlock_wrlock_common (pthread_rwlock_t *rwlock, const struct timespec *abstime) +rwlock_wrlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime) { struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; @@ -331,7 +338,7 @@ rwlock_wrlock_common (pthread_rwlock_t *rwlock, const struct timespec *abstime) } int -_pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) +_Tthr_rwlock_wrlock(pthread_rwlock_t *rwlock) { return (rwlock_wrlock_common (rwlock, NULL)); } @@ -344,7 +351,7 @@ _pthread_rwlock_timedwrlock(pthread_rwlock_t * __restrict rwlock, } int -_pthread_rwlock_unlock(pthread_rwlock_t *rwlock) +_Tthr_rwlock_unlock(pthread_rwlock_t *rwlock) { struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; diff --git a/lib/libthr/thread/thr_self.c b/lib/libthr/thread/thr_self.c index eb7c197e4f29..68bf5bc39312 100644 --- a/lib/libthr/thread/thr_self.c +++ b/lib/libthr/thread/thr_self.c @@ -38,10 +38,11 @@ __FBSDID("$FreeBSD$"); #include "thr_private.h" -__weak_reference(_pthread_self, pthread_self); +__weak_reference(_Tthr_self, pthread_self); +__weak_reference(_Tthr_self, _pthread_self); pthread_t -_pthread_self(void) +_Tthr_self(void) { _thr_check_init(); diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 576bc79de795..52494f79ab92 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -601,10 +601,11 @@ __thr_sigprocmask(int how, const sigset_t *set, sigset_t *oset) return (__sys_sigprocmask(how, p, oset)); } -__weak_reference(_pthread_sigmask, pthread_sigmask); +__weak_reference(_thr_sigmask, pthread_sigmask); +__weak_reference(_thr_sigmask, _pthread_sigmask); int -_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset) +_thr_sigmask(int how, const sigset_t *set, sigset_t *oset) { if (__thr_sigprocmask(how, set, oset)) diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c index d4da21d096a9..bce3d1fa2507 100644 --- a/lib/libthr/thread/thr_spec.c +++ b/lib/libthr/thread/thr_spec.c @@ -47,14 +47,17 @@ __FBSDID("$FreeBSD$"); /* Used in symbol lookup of libthread_db */ struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX]; -__weak_reference(_pthread_key_create, pthread_key_create); -__weak_reference(_pthread_key_delete, pthread_key_delete); -__weak_reference(_pthread_getspecific, pthread_getspecific); -__weak_reference(_pthread_setspecific, pthread_setspecific); - +__weak_reference(_thr_key_create, pthread_key_create); +__weak_reference(_thr_key_create, _pthread_key_create); +__weak_reference(_thr_key_delete, pthread_key_delete); +__weak_reference(_thr_key_delete, _pthread_key_delete); +__weak_reference(_thr_getspecific, pthread_getspecific); +__weak_reference(_thr_getspecific, _pthread_getspecific); +__weak_reference(_thr_setspecific, pthread_setspecific); +__weak_reference(_thr_setspecific, _pthread_setspecific); int -_pthread_key_create(pthread_key_t *key, void (*destructor)(void *)) +_thr_key_create(pthread_key_t *key, void (*destructor)(void *)) { struct pthread *curthread; int i; @@ -82,7 +85,7 @@ _pthread_key_create(pthread_key_t *key, void (*destructor)(void *)) } int -_pthread_key_delete(pthread_key_t userkey) +_thr_key_delete(pthread_key_t userkey) { struct pthread *curthread; int key, ret; @@ -165,7 +168,7 @@ _thread_cleanupspecific(void) } int -_pthread_setspecific(pthread_key_t userkey, const void *value) +_thr_setspecific(pthread_key_t userkey, const void *value) { struct pthread *pthread; void *tmp; @@ -195,7 +198,7 @@ _pthread_setspecific(pthread_key_t userkey, const void *value) } void * -_pthread_getspecific(pthread_key_t userkey) +_thr_getspecific(pthread_key_t userkey) { struct pthread *pthread; const void *data;