summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-12 09:25:56 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-13 08:10:24 +0100
commit7ced9d9bb2fd51cfef2ce33d22e779adfed604c2 (patch)
treee8388a0a3ad4776b6b11777719b391ffe2127064 /cpukit/score
parentscore: Add Thread_queue_Queue::name (diff)
downloadrtems-7ced9d9bb2fd51cfef2ce33d22e779adfed604c2.tar.bz2
score: Add and use _Thread_Get_name()
Update #2858.
Diffstat (limited to '')
-rw-r--r--cpukit/score/Makefile.am1
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h8
-rw-r--r--cpukit/score/src/threadname.c37
3 files changed, 45 insertions, 1 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 9b376c3f06..953f1eb195 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -299,6 +299,7 @@ libscore_a_SOURCES += src/threadentryadaptorpointer.c
libscore_a_SOURCES += src/threadgetcputimeused.c
libscore_a_SOURCES += src/threadglobalconstruction.c
libscore_a_SOURCES += src/threaditerate.c
+libscore_a_SOURCES += src/threadname.c
libscore_a_SOURCES += src/threadscheduler.c
libscore_a_SOURCES += src/threadtimeout.c
libscore_a_SOURCES += src/threadwaitgetid.c
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index f131bbd506..cb9e8e6539 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -11,7 +11,7 @@
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
- * Copyright (c) 2014, 2016 embedded brains GmbH.
+ * Copyright (c) 2014, 2017 embedded brains GmbH.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -1951,6 +1951,12 @@ RTEMS_INLINE_ROUTINE void _Thread_Remove_timer_and_unblock(
#endif
}
+size_t _Thread_Get_name(
+ const Thread_Control *the_thread,
+ char *buffer,
+ size_t buffer_size
+);
+
/** @}*/
#ifdef __cplusplus
diff --git a/cpukit/score/src/threadname.c b/cpukit/score/src/threadname.c
new file mode 100644
index 0000000000..6e4ffa4044
--- /dev/null
+++ b/cpukit/score/src/threadname.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2017 embedded brains GmbH.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/threadimpl.h>
+
+#include <string.h>
+
+size_t _Thread_Get_name(
+ const Thread_Control *the_thread,
+ char *buffer,
+ size_t buffer_size
+)
+{
+ const char *name;
+
+ name = the_thread->Join_queue.Queue.name;
+
+ if ( name != NULL && name[ 0 ] != '\0' ) {
+ return strlcpy( buffer, name, buffer_size );
+ } else {
+ return _Objects_Name_to_string(
+ the_thread->Object.name,
+ false,
+ buffer,
+ buffer_size
+ );
+ }
+}