Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115871682
D41461.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D41461.diff
View Options
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
@@ -426,6 +426,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
@@ -58,6 +58,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
@@ -131,6 +132,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)},
};
/*
@@ -289,6 +291,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)
@@ -337,3 +340,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
@@ -184,6 +184,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
@@ -114,9 +114,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;
@@ -147,5 +148,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
@@ -271,6 +271,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
@@ -1073,6 +1073,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
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 30, 8:12 PM (12 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17864345
Default Alt Text
D41461.diff (3 KB)
Attached To
Mode
D41461: libc: make pthread_getname_np and _pthread_getname_np available
Attached
Detach File
Event Timeline
Log In to Comment