From 2b454faf137960da9b7c783a159902ac1cc02469 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 26 Apr 2002 23:56:56 +0000 Subject: 2001-04-26 Joel Sherrill * include/rtems/score/object.h, inline/rtems/score/object.inl, src/objectcomparenamestring.c: Address PR81 that reworked POSIX message queues to add a descriptor separate from the underlying message queue. This allows non-blocking to follow the "open" not the underlying queue. As part of debugging this it became clear that _Objects_Compare_name_string was broken and a simple version using strncmp() was substituted. --- c/src/exec/score/ChangeLog | 10 ++++++++++ c/src/exec/score/include/rtems/score/object.h | 25 ++++++++++++------------ c/src/exec/score/inline/rtems/score/object.inl | 9 ++++++--- c/src/exec/score/src/objectcomparenamestring.c | 27 +++++++++++++------------- 4 files changed, 42 insertions(+), 29 deletions(-) (limited to 'c') diff --git a/c/src/exec/score/ChangeLog b/c/src/exec/score/ChangeLog index 1b83f0d663..b24ecbf42c 100644 --- a/c/src/exec/score/ChangeLog +++ b/c/src/exec/score/ChangeLog @@ -1,3 +1,13 @@ +2001-04-26 Joel Sherrill + + * include/rtems/score/object.h, inline/rtems/score/object.inl, + src/objectcomparenamestring.c: Address PR81 that + reworked POSIX message queues to add a descriptor separate from + the underlying message queue. This allows non-blocking to follow + the "open" not the underlying queue. As part of debugging this + it became clear that _Objects_Compare_name_string was broken + and a simple version using strncmp() was substituted. + 2002-04-18 Ralf Corsepius * include/rtems/system.h: Remove targopts.h. diff --git a/c/src/exec/score/include/rtems/score/object.h b/c/src/exec/score/include/rtems/score/object.h index ced94e685b..4b9af7f075 100644 --- a/c/src/exec/score/include/rtems/score/object.h +++ b/c/src/exec/score/include/rtems/score/object.h @@ -5,7 +5,7 @@ * can be used to initialize and manipulate all objects which have * ids. * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -99,17 +99,18 @@ typedef enum { OBJECTS_RTEMS_EXTENSIONS = 12, OBJECTS_POSIX_KEYS = 13, OBJECTS_POSIX_INTERRUPTS = 14, - OBJECTS_POSIX_MESSAGE_QUEUES = 15, - OBJECTS_POSIX_MUTEXES = 16, - OBJECTS_POSIX_SEMAPHORES = 17, - OBJECTS_POSIX_CONDITION_VARIABLES = 18, - OBJECTS_ITRON_EVENTFLAGS = 19, - OBJECTS_ITRON_MAILBOXES = 20, - OBJECTS_ITRON_MESSAGE_BUFFERS = 21, - OBJECTS_ITRON_PORTS = 22, - OBJECTS_ITRON_SEMAPHORES = 23, - OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 24, - OBJECTS_ITRON_FIXED_MEMORY_POOLS = 25 + OBJECTS_POSIX_MESSAGE_QUEUE_FDS = 15, + OBJECTS_POSIX_MESSAGE_QUEUES = 16, + OBJECTS_POSIX_MUTEXES = 17, + OBJECTS_POSIX_SEMAPHORES = 18, + OBJECTS_POSIX_CONDITION_VARIABLES = 19, + OBJECTS_ITRON_EVENTFLAGS = 10, + OBJECTS_ITRON_MAILBOXES = 21, + OBJECTS_ITRON_MESSAGE_BUFFERS = 22, + OBJECTS_ITRON_PORTS = 23, + OBJECTS_ITRON_SEMAPHORES = 24, + OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 25, + OBJECTS_ITRON_FIXED_MEMORY_POOLS = 26 } Objects_Classes; #define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS diff --git a/c/src/exec/score/inline/rtems/score/object.inl b/c/src/exec/score/inline/rtems/score/object.inl index c24e43f276..ae36d1c819 100644 --- a/c/src/exec/score/inline/rtems/score/object.inl +++ b/c/src/exec/score/inline/rtems/score/object.inl @@ -242,7 +242,8 @@ RTEMS_INLINE_ROUTINE void _Objects_Open( _Objects_Set_local_object( information, index, the_object ); if ( information->is_string ) - _Objects_Copy_name_string( name, the_object->name ); + /* _Objects_Copy_name_string( name, the_object->name ); */ + the_object->name = name; else _Objects_Copy_name_raw( name, the_object->name, information->name_length ); } @@ -266,7 +267,8 @@ RTEMS_INLINE_ROUTINE void _Objects_Close( index = _Objects_Get_index( the_object->id ); _Objects_Set_local_object( information, index, NULL ); - _Objects_Clear_name( the_object->name, information->name_length ); + /* _Objects_Clear_name( the_object->name, information->name_length ); */ + the_object->name = 0; } /*PAGE @@ -283,7 +285,8 @@ RTEMS_INLINE_ROUTINE void _Objects_Namespace_remove( Objects_Control *the_object ) { - _Objects_Clear_name( the_object->name, information->name_length ); + /* _Objects_Clear_name( the_object->name, information->name_length ); */ + the_object->name = 0; } #endif diff --git a/c/src/exec/score/src/objectcomparenamestring.c b/c/src/exec/score/src/objectcomparenamestring.c index 9b1067bacb..045063e7cd 100644 --- a/c/src/exec/score/src/objectcomparenamestring.c +++ b/c/src/exec/score/src/objectcomparenamestring.c @@ -2,7 +2,7 @@ * Object Handler * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -28,7 +28,15 @@ * * _Objects_Compare_name_string * - * XXX + * This routine compares the name of an object with the specified string. + * + * Input parameters: + * name_1 - one name + * name_2 - other name + * length - maximum length to compare + * + * Output parameters: + * returns - TRUE on a match */ boolean _Objects_Compare_name_string( @@ -37,16 +45,7 @@ boolean _Objects_Compare_name_string( unsigned32 length ) { - unsigned8 *name_1_p = (unsigned8 *) name_1; - unsigned8 *name_2_p = (unsigned8 *) name_2; - unsigned32 tmp_length = length; - - do { - if ( *name_1_p++ != *name_2_p++ ) - return FALSE; - if ( !tmp_length-- ) - return FALSE; - } while ( *name_1_p ); - - return TRUE; + if ( !strncmp( name_1_p, name_2_p, length ) ) + return TRUE; + return FALSE; } -- cgit v1.2.3