summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/frr_pthread.c35
-rw-r--r--lib/frr_pthread.h9
2 files changed, 8 insertions, 36 deletions
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c
index c5aec8ca72..d5a2007c4d 100644
--- a/lib/frr_pthread.c
+++ b/lib/frr_pthread.c
@@ -117,36 +117,19 @@ void frr_pthread_destroy(struct frr_pthread *fpt)
XFREE(MTYPE_FRR_PTHREAD, fpt);
}
-int frr_pthread_set_name(struct frr_pthread *fpt, const char *name,
- const char *os_name)
+int frr_pthread_set_name(struct frr_pthread *fpt)
{
int ret = 0;
- if (name) {
- pthread_mutex_lock(&fpt->mtx);
- {
- if (fpt->name)
- XFREE(MTYPE_FRR_PTHREAD, fpt->name);
- fpt->name = XSTRDUP(MTYPE_FRR_PTHREAD, name);
- }
- pthread_mutex_unlock(&fpt->mtx);
- thread_master_set_name(fpt->master, name);
- }
-
- if (os_name) {
- pthread_mutex_lock(&fpt->mtx);
- snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", os_name);
- pthread_mutex_unlock(&fpt->mtx);
#ifdef HAVE_PTHREAD_SETNAME_NP
# ifdef GNU_LINUX
- ret = pthread_setname_np(fpt->thread, fpt->os_name);
+ ret = pthread_setname_np(fpt->thread, fpt->os_name);
# else /* NetBSD */
- ret = pthread_setname_np(fpt->thread, fpt->os_name, NULL);
+ ret = pthread_setname_np(fpt->thread, fpt->os_name, NULL);
# endif
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
- pthread_set_name_np(fpt->thread, fpt->os_name);
+ pthread_set_name_np(fpt->thread, fpt->os_name);
#endif
- }
return ret;
}
@@ -275,15 +258,7 @@ static void *fpt_run(void *arg)
fpt->master->handle_signals = false;
-#ifdef HAVE_PTHREAD_SETNAME_NP
-# ifdef GNU_LINUX
- pthread_setname_np(fpt->thread, fpt->os_name);
-# else /* NetBSD */
- pthread_setname_np(fpt->thread, fpt->os_name, NULL);
-# endif
-#elif defined(HAVE_PTHREAD_SET_NAME_NP)
- pthread_set_name_np(fpt->thread, fpt->os_name);
-#endif
+ frr_pthread_set_name(fpt);
frr_pthread_notify_running(fpt);
diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h
index b9e60511d5..e6b3f031b3 100644
--- a/lib/frr_pthread.h
+++ b/lib/frr_pthread.h
@@ -133,16 +133,13 @@ struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr,
const char *name, const char *os_name);
/*
- * Changes the name of the frr_pthread.
+ * Changes the name of the frr_pthread as reported by the operating
+ * system.
*
* @param fpt - the frr_pthread to operate on
- * @param name - Human-readable name
- * @param os_name - 16 characters thread name , including the null
- * terminator ('\0') to set in os.
* @return - on success returns 0 otherwise nonzero error number.
*/
-int frr_pthread_set_name(struct frr_pthread *fpt, const char *name,
- const char *os_name);
+int frr_pthread_set_name(struct frr_pthread *fpt);
/*
* Destroys an frr_pthread.