5
Last change
on this file since 2548d14 was
6dbbafc6,
checked in by Sebastian Huber <sebastian.huber@…>, on 02/14/17 at 07:42:48
|
score: Fix warning in _Thread_Set_name()
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2017 embedded brains GmbH. |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | |
---|
9 | #if HAVE_CONFIG_H |
---|
10 | #include "config.h" |
---|
11 | #endif |
---|
12 | |
---|
13 | #include <rtems/score/threadimpl.h> |
---|
14 | |
---|
15 | #include <string.h> |
---|
16 | |
---|
17 | Status_Control _Thread_Set_name( |
---|
18 | Thread_Control *the_thread, |
---|
19 | const char *name |
---|
20 | ) |
---|
21 | { |
---|
22 | size_t length; |
---|
23 | |
---|
24 | length = strlcpy( |
---|
25 | RTEMS_DECONST( char *, 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 | } |
---|
36 | |
---|
37 | size_t _Thread_Get_name( |
---|
38 | const Thread_Control *the_thread, |
---|
39 | char *buffer, |
---|
40 | size_t buffer_size |
---|
41 | ) |
---|
42 | { |
---|
43 | const char *name; |
---|
44 | |
---|
45 | name = the_thread->Join_queue.Queue.name; |
---|
46 | |
---|
47 | if ( name != NULL && name[ 0 ] != '\0' ) { |
---|
48 | return strlcpy( buffer, name, buffer_size ); |
---|
49 | } else { |
---|
50 | return _Objects_Name_to_string( |
---|
51 | the_thread->Object.name, |
---|
52 | false, |
---|
53 | buffer, |
---|
54 | buffer_size |
---|
55 | ); |
---|
56 | } |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.