summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-27 16:52:48 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-02 07:46:16 +0200
commit77726405fab31a04834e95968d1942fc81d0644d (patch)
tree7932e1e26c59879857de832abec8f9a2be9ca1e2
parentrtems: Avoid Giant lock in rtems_object_set_name() (diff)
downloadrtems-77726405fab31a04834e95968d1942fc81d0644d.tar.bz2
score: _Objects_Get_name_as_string()
Avoid Giant lock in _Objects_Get_name_as_string(). Update #2555.
-rw-r--r--cpukit/score/src/objectgetnameasstring.c68
1 files changed, 29 insertions, 39 deletions
diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c
index 7505c02c9f..d73d8aa212 100644
--- a/cpukit/score/src/objectgetnameasstring.c
+++ b/cpukit/score/src/objectgetnameasstring.c
@@ -41,7 +41,7 @@ char *_Objects_Get_name_as_string(
uint32_t i;
char lname[5];
Objects_Control *the_object;
- Objects_Locations location;
+ ISR_lock_Context lock_context;
Objects_Id tmpId;
if ( length == 0 )
@@ -56,45 +56,35 @@ char *_Objects_Get_name_as_string(
if ( !information )
return NULL;
- the_object = _Objects_Get( information, tmpId, &location );
- switch ( location ) {
-
- case OBJECTS_LOCAL:
-
- #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
- if ( information->is_string ) {
- s = the_object->name.name_p;
- } else
- #endif
- {
- uint32_t u32_name = (uint32_t) the_object->name.name_u32;
-
- lname[ 0 ] = (u32_name >> 24) & 0xff;
- lname[ 1 ] = (u32_name >> 16) & 0xff;
- lname[ 2 ] = (u32_name >> 8) & 0xff;
- lname[ 3 ] = (u32_name >> 0) & 0xff;
- lname[ 4 ] = '\0';
- s = lname;
- }
-
- d = name;
- if ( s ) {
- for ( i=0 ; i<(length-1) && *s ; i++, s++, d++ ) {
- *d = (isprint((unsigned char)*s)) ? *s : '*';
- }
- }
- *d = '\0';
-
- _Objects_Put( the_object );
- return name;
+ the_object = _Objects_Get_local( tmpId, information, &lock_context );
+ if ( the_object == NULL ) {
+ return NULL;
+ }
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- /* not supported */
-#endif
- case OBJECTS_ERROR:
- return NULL;
+ #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
+ if ( information->is_string ) {
+ s = the_object->name.name_p;
+ } else
+ #endif
+ {
+ uint32_t u32_name = (uint32_t) the_object->name.name_u32;
+
+ lname[ 0 ] = (u32_name >> 24) & 0xff;
+ lname[ 1 ] = (u32_name >> 16) & 0xff;
+ lname[ 2 ] = (u32_name >> 8) & 0xff;
+ lname[ 3 ] = (u32_name >> 0) & 0xff;
+ lname[ 4 ] = '\0';
+ s = lname;
+ }
+ d = name;
+ if ( s ) {
+ for ( i=0 ; i<(length-1) && *s ; i++, s++, d++ ) {
+ *d = (isprint((unsigned char)*s)) ? *s : '*';
+ }
}
- return NULL; /* unreachable path */
+ *d = '\0';
+
+ _ISR_lock_ISR_enable( &lock_context );
+ return name;
}