libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.

This seems to be required by recent clang asan.
I do not see other way than put the symbol under FBSD_1.0 version.

PR:	251112
Reported by:	Andrew Stitcher <astitcher@apache.org>
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D27389
This commit is contained in:
Konstantin Belousov 2020-11-28 12:19:20 +00:00
parent cd85379104
commit 412ef5da8a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368125
4 changed files with 12 additions and 0 deletions

View file

@ -6,6 +6,7 @@ FBSD_1.0 {
__xuname;
pthread_atfork;
pthread_attr_destroy;
pthread_attr_get_np;
pthread_attr_getdetachstate;
pthread_attr_getguardsize;
pthread_attr_getinheritsched;

View file

@ -59,6 +59,7 @@ static int stub_zero(void);
static int stub_fail(void);
static int stub_true(void);
static void stub_exit(void);
static int stub_esrch(void);
#define PJT_DUAL_ENTRY(entry) \
(pthread_func_t)entry, (pthread_func_t)entry
@ -131,6 +132,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
[PJT_MUTEXATTR_GETROBUST] = {PJT_DUAL_ENTRY(stub_zero)},
[PJT_MUTEXATTR_SETROBUST] = {PJT_DUAL_ENTRY(stub_zero)},
[PJT_GETTHREADID_NP] = {PJT_DUAL_ENTRY(stub_zero)},
[PJT_ATTR_GET_NP] = {PJT_DUAL_ENTRY(stub_esrch)},
};
/*
@ -288,6 +290,7 @@ STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void *,
void *, void *)
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 *)
static int
stub_zero(void)
@ -330,3 +333,9 @@ stub_exit(void)
{
exit(0);
}
static int
stub_esrch(void)
{
return (ESRCH);
}

View file

@ -177,6 +177,7 @@ typedef enum {
PJT_MUTEXATTR_GETROBUST,
PJT_MUTEXATTR_SETROBUST,
PJT_GETTHREADID_NP,
PJT_ATTR_GET_NP,
PJT_MAX
} pjt_index_t;

View file

@ -271,6 +271,7 @@ static pthread_func_t jmp_table[][2] = {
[PJT_MUTEXATTR_GETROBUST] = {DUAL_ENTRY(_thr_mutexattr_getrobust)},
[PJT_MUTEXATTR_SETROBUST] = {DUAL_ENTRY(_thr_mutexattr_setrobust)},
[PJT_GETTHREADID_NP] = {DUAL_ENTRY(_thr_getthreadid_np)},
[PJT_ATTR_GET_NP] = {DUAL_ENTRY(_thr_attr_get_np)},
};
static int init_once = 0;