mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-23 07:31:31 +00:00
libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np
If libthr isn't linked into the process, then we don't have any pthreads to worry about and our stubs can just return success -- there are none to suspend/resume. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D47350
This commit is contained in:
parent
092e2ff33b
commit
83aafcdc88
@ -47,6 +47,7 @@ FBSD_1.0 {
|
||||
pthread_mutexattr_init;
|
||||
pthread_mutexattr_settype;
|
||||
pthread_once;
|
||||
pthread_resume_all_np;
|
||||
pthread_rwlock_destroy;
|
||||
pthread_rwlock_init;
|
||||
pthread_rwlock_rdlock;
|
||||
@ -59,6 +60,7 @@ FBSD_1.0 {
|
||||
pthread_setcanceltype;
|
||||
pthread_setspecific;
|
||||
pthread_sigmask;
|
||||
pthread_suspend_all_np;
|
||||
pthread_testcancel;
|
||||
alarm;
|
||||
arc4random;
|
||||
|
@ -132,6 +132,8 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||
[PJT_GETTHREADID_NP] = {PJT_DUAL_ENTRY(stub_zero)},
|
||||
[PJT_ATTR_GET_NP] = {PJT_DUAL_ENTRY(stub_esrch)},
|
||||
[PJT_GETNAME_NP] = {PJT_DUAL_ENTRY(stub_getname_np)},
|
||||
[PJT_SUSPEND_ALL_NP] = {PJT_DUAL_ENTRY(stub_null)},
|
||||
[PJT_RESUME_ALL_NP] = {PJT_DUAL_ENTRY(stub_null)},
|
||||
};
|
||||
|
||||
/*
|
||||
@ -291,6 +293,8 @@ STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int)
|
||||
STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int)
|
||||
STUB_FUNC2(pthread_attr_get_np, PJT_ATTR_GET_NP, int, pthread_t, pthread_attr_t *)
|
||||
STUB_FUNC3(pthread_getname_np, PJT_GETNAME_NP, int, pthread_t, char *, size_t)
|
||||
STUB_FUNC(pthread_suspend_all_np, PJT_SUSPEND_ALL_NP, void);
|
||||
STUB_FUNC(pthread_resume_all_np, PJT_RESUME_ALL_NP, void);
|
||||
|
||||
static int
|
||||
stub_zero(void)
|
||||
|
@ -187,6 +187,8 @@ typedef enum {
|
||||
PJT_GETTHREADID_NP,
|
||||
PJT_ATTR_GET_NP,
|
||||
PJT_GETNAME_NP,
|
||||
PJT_SUSPEND_ALL_NP,
|
||||
PJT_RESUME_ALL_NP,
|
||||
PJT_MAX
|
||||
} pjt_index_t;
|
||||
|
||||
|
@ -271,6 +271,8 @@ static pthread_func_t jmp_table[][2] = {
|
||||
[PJT_GETTHREADID_NP] = {DUAL_ENTRY(_thr_getthreadid_np)},
|
||||
[PJT_ATTR_GET_NP] = {DUAL_ENTRY(_thr_attr_get_np)},
|
||||
[PJT_GETNAME_NP] = {DUAL_ENTRY(_thr_getname_np)},
|
||||
[PJT_SUSPEND_ALL_NP] = {DUAL_ENTRY(_thr_suspend_all_np)},
|
||||
[PJT_RESUME_ALL_NP] = {DUAL_ENTRY(_thr_resume_all_np)},
|
||||
};
|
||||
|
||||
static int init_once = 0;
|
||||
|
@ -840,6 +840,8 @@ void _thr_signal_postfork(void) __hidden;
|
||||
void _thr_signal_postfork_child(void) __hidden;
|
||||
void _thr_suspend_all_lock(struct pthread *) __hidden;
|
||||
void _thr_suspend_all_unlock(struct pthread *) __hidden;
|
||||
void _thr_suspend_all_np(void) __hidden;
|
||||
void _thr_resume_all_np(void) __hidden;
|
||||
void _thr_try_gc(struct pthread *, struct pthread *) __hidden;
|
||||
int _rtp_to_schedparam(const struct rtprio *rtp, int *policy,
|
||||
struct sched_param *param) __hidden;
|
||||
|
@ -38,7 +38,8 @@
|
||||
#include "thr_private.h"
|
||||
|
||||
__weak_reference(_pthread_resume_np, pthread_resume_np);
|
||||
__weak_reference(_pthread_resume_all_np, pthread_resume_all_np);
|
||||
__weak_reference(_thr_resume_all_np, pthread_resume_all_np);
|
||||
__weak_reference(_thr_resume_all_np, _pthread_resume_all_np);
|
||||
|
||||
static void resume_common(struct pthread *thread);
|
||||
|
||||
@ -59,7 +60,7 @@ _pthread_resume_np(pthread_t thread)
|
||||
}
|
||||
|
||||
void
|
||||
_pthread_resume_all_np(void)
|
||||
_thr_resume_all_np(void)
|
||||
{
|
||||
struct pthread *curthread = _get_curthread();
|
||||
struct pthread *thread;
|
||||
|
@ -41,7 +41,8 @@ static int suspend_common(struct pthread *, struct pthread *,
|
||||
int);
|
||||
|
||||
__weak_reference(_pthread_suspend_np, pthread_suspend_np);
|
||||
__weak_reference(_pthread_suspend_all_np, pthread_suspend_all_np);
|
||||
__weak_reference(_thr_suspend_all_np, pthread_suspend_all_np);
|
||||
__weak_reference(_thr_suspend_all_np, _pthread_suspend_all_np);
|
||||
|
||||
/* Suspend a thread: */
|
||||
int
|
||||
@ -101,7 +102,7 @@ _thr_suspend_all_unlock(struct pthread *curthread)
|
||||
}
|
||||
|
||||
void
|
||||
_pthread_suspend_all_np(void)
|
||||
_thr_suspend_all_np(void)
|
||||
{
|
||||
struct pthread *curthread = _get_curthread();
|
||||
struct pthread *thread;
|
||||
|
Loading…
Reference in New Issue
Block a user