Changeset da6ad56 in rtems


Ignore:
Timestamp:
Jan 12, 2017, 12:46:55 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7c499279
Parents:
7ced9d9b
git-author:
Sebastian Huber <sebastian.huber@…> (01/12/17 12:46:55)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/13/17 07:10:28)
Message:

score: Add _Thread_Set_name()

Add configuration option CONFIGURE_MAXIMUM_THREAD_NAME_SIZE.

Update #2858.

Location:
cpukit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/confdefs.h

    r7ced9d9b rda6ad56  
    32003200  )
    32013201
     3202#ifndef CONFIGURE_MAXIMUM_THREAD_NAME_SIZE
     3203  #define CONFIGURE_MAXIMUM_THREAD_NAME_SIZE 16
     3204#endif
     3205
    32023206#ifdef CONFIGURE_INIT
    32033207  typedef union {
     
    32333237  #endif
    32343238
     3239  const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
     3240
    32353241  typedef struct {
    32363242    Thread_Control Control;
     
    32423248    #ifdef RTEMS_POSIX_API
    32433249      POSIX_API_Control API_POSIX;
     3250    #endif
     3251    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
     3252      char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ];
    32443253    #endif
    32453254    #if !defined(RTEMS_SCHEDSIM) \
     
    32713280      offsetof( Configuration_Thread_control, Newlib )
    32723281    }
     3282    #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1
     3283      , {
     3284        offsetof(
     3285          Configuration_Thread_control,
     3286          Control.Join_queue.Queue.name
     3287        ),
     3288        offsetof( Configuration_Thread_control, name )
     3289      }
     3290    #endif
    32733291    #ifdef RTEMS_POSIX_API
    32743292      , {
  • cpukit/score/include/rtems/score/status.h

    r7ced9d9b rda6ad56  
    116116  STATUS_RESOURCE_IN_USE =
    117117    STATUS_BUILD( STATUS_CLASSIC_RESOURCE_IN_USE, EBUSY ),
     118  STATUS_RESULT_TOO_LARGE =
     119    STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, ERANGE ),
    118120  STATUS_SUCCESSFUL =
    119121    STATUS_BUILD( STATUS_CLASSIC_SUCCESSFUL, 0 ),
  • cpukit/score/include/rtems/score/thread.h

    r7ced9d9b rda6ad56  
    908908extern const size_t _Thread_Control_size;
    909909
     910/**
     911 * @brief Maximum size of a thread name in characters (including the
     912 * terminating '\0' character).
     913 *
     914 * This value is provided via <rtems/confdefs.h>.
     915 */
     916extern const size_t _Thread_Maximum_name_size;
     917
    910918/**@}*/
    911919
  • cpukit/score/include/rtems/score/threadimpl.h

    r7ced9d9b rda6ad56  
    19521952}
    19531953
     1954Status_Control _Thread_Set_name(
     1955  Thread_Control *the_thread,
     1956  const char     *name
     1957);
     1958
    19541959size_t _Thread_Get_name(
    19551960  const Thread_Control *the_thread,
  • cpukit/score/src/threadname.c

    r7ced9d9b rda6ad56  
    1414
    1515#include <string.h>
     16
     17Status_Control _Thread_Set_name(
     18  Thread_Control *the_thread,
     19  const char     *name
     20)
     21{
     22  size_t length;
     23
     24  length = strlcpy(
     25    the_thread->Join_queue.Queue.name,
     26    name,
     27    _Thread_Maximum_name_size
     28  );
     29
     30  if ( length >= _Thread_Maximum_name_size ) {
     31    return STATUS_RESULT_TOO_LARGE;
     32  }
     33
     34  return STATUS_SUCCESSFUL;
     35}
    1636
    1737size_t _Thread_Get_name(
Note: See TracChangeset for help on using the changeset viewer.