Page MenuHomeFreeBSD

D41461.id126273.diff
No OneTemporary

D41461.id126273.diff

diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -427,6 +427,7 @@
eventfd_write;
getlogin_r;
memalign;
+ pthread_getname_np;
scandir_b;
sigandset;
sigisemptyset;
diff --git a/lib/libc/gen/_pthread_stubs.c b/lib/libc/gen/_pthread_stubs.c
--- a/lib/libc/gen/_pthread_stubs.c
+++ b/lib/libc/gen/_pthread_stubs.c
@@ -60,6 +60,7 @@
static int stub_true(void);
static void stub_exit(void);
static int stub_esrch(void);
+static int stub_getname_np(pthread_t, char *, size_t);
#define PJT_DUAL_ENTRY(entry) \
(pthread_func_t)entry, (pthread_func_t)entry
@@ -133,6 +134,7 @@
[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)},
+ [PJT_GETNAME_NP] = {PJT_DUAL_ENTRY(stub_getname_np)},
};
/*
@@ -291,6 +293,7 @@
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)
static int
stub_zero(void)
@@ -339,3 +342,13 @@
{
return (ESRCH);
}
+
+static int
+stub_getname_np(pthread_t thread, char *buf, size_t len)
+{
+ if (thread != &main_thread)
+ return (ESRCH);
+ if (len >= 1)
+ buf[0] = '\0';
+ return (0);
+}
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -186,6 +186,7 @@
PJT_MUTEXATTR_SETROBUST,
PJT_GETTHREADID_NP,
PJT_ATTR_GET_NP,
+ PJT_GETNAME_NP,
PJT_MAX
} pjt_index_t;
diff --git a/lib/libthr/thread/thr_info.c b/lib/libthr/thread/thr_info.c
--- a/lib/libthr/thread/thr_info.c
+++ b/lib/libthr/thread/thr_info.c
@@ -116,9 +116,10 @@
buf[0] = '\0';
}
-__weak_reference(_pthread_getname_np, pthread_getname_np);
+__weak_reference(_thr_getname_np, pthread_getname_np);
+__weak_reference(_thr_getname_np, _pthread_getname_np);
int
-_pthread_getname_np(pthread_t thread, char *buf, size_t len)
+_thr_getname_np(pthread_t thread, char *buf, size_t len)
{
struct pthread *curthread;
int res;
@@ -149,5 +150,5 @@
void
_pthread_get_name_np(pthread_t thread, char *buf, size_t len)
{
- (void)_pthread_getname_np(thread, buf, len);
+ (void)_thr_getname_np(thread, buf, len);
}
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -273,6 +273,7 @@
[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)},
+ [PJT_GETNAME_NP] = {DUAL_ENTRY(_thr_getname_np)},
};
static int init_once = 0;
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -1075,6 +1075,7 @@
int _thr_detach(pthread_t);
int _thr_equal(pthread_t, pthread_t);
void _Tthr_exit(void *);
+int _thr_getname_np(pthread_t, char *, size_t);
int _thr_key_create(pthread_key_t *, void (*)(void *));
int _thr_key_delete(pthread_key_t);
int _thr_setspecific(pthread_key_t, const void *);

File Metadata

Mime Type
text/plain
Expires
Thu, May 1, 2:06 AM (13 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17869970
Default Alt Text
D41461.id126273.diff (3 KB)

Event Timeline