summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-18 07:25:23 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-18 15:36:58 +0100
commitc904df573396d95957dc79b242b3a76911063089 (patch)
treebe6406676689018e8af8a929b6a4ef5284f94c70
parentsptests/sptls02: Use GNU++11 (diff)
downloadrtems-c904df573396d95957dc79b242b3a76911063089.tar.bz2
score: Add _Objects_Get_by_name()
Replace _Objects_Name_to_id_string() with _Objects_Get_by_name() since all users of this function are interested in the object itself and not the identifier. Use the object allocator lock to protect the search. Update #2555.
-rw-r--r--cpukit/posix/include/rtems/posix/mqueueimpl.h21
-rw-r--r--cpukit/posix/include/rtems/posix/posixapi.h31
-rw-r--r--cpukit/posix/include/rtems/posix/semaphoreimpl.h20
-rw-r--r--cpukit/posix/src/mqueueopen.c18
-rw-r--r--cpukit/posix/src/mqueueunlink.c35
-rw-r--r--cpukit/posix/src/psxnametoid.c44
-rw-r--r--cpukit/posix/src/semopen.c18
-rw-r--r--cpukit/posix/src/semunlink.c28
-rw-r--r--cpukit/score/include/rtems/score/objectimpl.h39
-rw-r--r--cpukit/score/src/objectnametoidstring.c59
-rw-r--r--testsuites/psxtests/psxmsgq01/init.c6
-rw-r--r--testsuites/psxtests/psxmsgq01/psxmsgq01.scn45
-rw-r--r--testsuites/psxtests/psxobj01/init.c48
-rw-r--r--testsuites/psxtests/psxobj01/psxobj01.scn11
-rw-r--r--testsuites/psxtests/psxsem01/init.c4
-rw-r--r--testsuites/psxtests/psxsem01/psxsem01.scn15
16 files changed, 192 insertions, 250 deletions
diff --git a/cpukit/posix/include/rtems/posix/mqueueimpl.h b/cpukit/posix/include/rtems/posix/mqueueimpl.h
index 6646fa2c65..cf0f76af32 100644
--- a/cpukit/posix/include/rtems/posix/mqueueimpl.h
+++ b/cpukit/posix/include/rtems/posix/mqueueimpl.h
@@ -246,17 +246,20 @@ _POSIX_Message_queue_Get_fd_interrupt_disable(
lock_context
);
}
-
-/**
- * @see _POSIX_Name_to_id().
- */
-RTEMS_INLINE_ROUTINE int _POSIX_Message_queue_Name_to_id(
- const char *name,
- Objects_Id *id,
- size_t *len
+
+RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *
+_POSIX_Message_queue_Get_by_name(
+ const char *name,
+ size_t *name_length_p,
+ Objects_Get_by_name_error *error
)
{
- return _POSIX_Name_to_id( &_POSIX_Message_queue_Information, name, id, len );
+ return (POSIX_Message_queue_Control *) _Objects_Get_by_name(
+ &_POSIX_Message_queue_Information,
+ name,
+ name_length_p,
+ error
+ );
}
#ifdef __cplusplus
diff --git a/cpukit/posix/include/rtems/posix/posixapi.h b/cpukit/posix/include/rtems/posix/posixapi.h
index 8fee7a4f32..0348e28e16 100644
--- a/cpukit/posix/include/rtems/posix/posixapi.h
+++ b/cpukit/posix/include/rtems/posix/posixapi.h
@@ -20,6 +20,7 @@
#define _RTEMS_POSIX_POSIXAPI_H
#include <rtems/config.h>
+#include <rtems/score/assert.h>
#include <rtems/score/objectimpl.h>
/**
@@ -48,27 +49,15 @@ typedef enum {
*/
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
-/**
- * @brief Queries the object identifier @a id for a @a name.
- *
- * @param[in] information Object information.
- * @param[in] name Zero terminated name string to look up.
- * @param[out] id Pointer for identifier. The pointer must be valid.
- * @param[out] len Pointer for string length. The pointer must be valid.
- *
- * @retval 0 Successful operation.
- * @retval EINVAL The @a name pointer is @c NULL or the @a name string has
- * zero length.
- * @retval ENAMETOOLONG The @a name string length is greater than or equal to
- * @c NAME_MAX.
- * @retval ENOENT Found no corresponding identifier.
- */
-int _POSIX_Name_to_id(
- Objects_Information *information,
- const char *name,
- Objects_Id *id,
- size_t *len
-);
+extern const int _POSIX_Get_by_name_error_table[ 3 ];
+
+RTEMS_INLINE_ROUTINE int _POSIX_Get_by_name_error(
+ Objects_Get_by_name_error error
+)
+{
+ _Assert( (size_t) error < RTEMS_ARRAY_SIZE( _POSIX_Get_by_name_error_table ) );
+ return _POSIX_Get_by_name_error_table[ error ];
+}
/** @} */
diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
index fe5ee44034..8608e6f33d 100644
--- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
+++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
@@ -163,17 +163,19 @@ RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Namespace_remove (
_Objects_Namespace_remove(
&_POSIX_Semaphore_Information, &the_semaphore->Object );
}
-
-/**
- * @see _POSIX_Name_to_id().
- */
-RTEMS_INLINE_ROUTINE int _POSIX_Semaphore_Name_to_id(
- const char *name,
- Objects_Id *id,
- size_t *len
+
+RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get_by_name(
+ const char *name,
+ size_t *name_length_p,
+ Objects_Get_by_name_error *error
)
{
- return _POSIX_Name_to_id( &_POSIX_Semaphore_Information, name, id, len );
+ return (POSIX_Semaphore_Control *) _Objects_Get_by_name(
+ &_POSIX_Semaphore_Information,
+ name,
+ name_length_p,
+ error
+ );
}
#ifdef __cplusplus
diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c
index 005de74158..d327e13fac 100644
--- a/cpukit/posix/src/mqueueopen.c
+++ b/cpukit/posix/src/mqueueopen.c
@@ -67,11 +67,10 @@ mqd_t mq_open(
va_list arg;
struct mq_attr *attr = NULL;
int status;
- Objects_Id the_mq_id;
POSIX_Message_queue_Control *the_mq;
POSIX_Message_queue_Control_fd *the_mq_fd;
- Objects_Locations location;
size_t name_len;
+ Objects_Get_by_name_error error;
if ( oflag & O_CREAT ) {
va_start(arg, oflag);
@@ -87,7 +86,7 @@ mqd_t mq_open(
}
the_mq_fd->oflag = oflag;
- status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id, &name_len );
+ the_mq = _POSIX_Message_queue_Get_by_name( name, &name_len, &error );
/*
* If the name to id translation worked, then the message queue exists
@@ -95,15 +94,18 @@ mqd_t mq_open(
* need to check to see if this is a "message queue does not exist"
* or some other miscellaneous error on the name.
*/
- if ( status ) {
+ if ( the_mq == NULL ) {
/*
* Unless provided a valid name that did not already exist
* and we are willing to create then it is an error.
*/
- if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
+ if ( !( error == OBJECTS_GET_BY_NAME_NO_OBJECT && (oflag & O_CREAT) ) ) {
_POSIX_Message_queue_Free_fd( the_mq_fd );
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_value( status, MQ_OPEN_FAILED );
+ rtems_set_errno_and_return_value(
+ _POSIX_Get_by_name_error( error ),
+ MQ_OPEN_FAILED
+ );
}
} else { /* name -> ID translation succeeded */
@@ -120,7 +122,6 @@ mqd_t mq_open(
* In this case we need to do an ID->pointer conversion to
* check the mode.
*/
- the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
the_mq->open_count += 1;
the_mq_fd->Queue = the_mq;
_Objects_Open_string(
@@ -128,7 +129,6 @@ mqd_t mq_open(
&the_mq_fd->Object,
NULL
);
- _Thread_Enable_dispatch();
_Objects_Allocator_unlock();
return the_mq_fd->Object.id;
@@ -149,7 +149,7 @@ mqd_t mq_open(
/*
* errno was set by Create_support, so don't set it again.
*/
- if ( status == -1 ) {
+ if ( status != 0 ) {
_POSIX_Message_queue_Free_fd( the_mq_fd );
_Objects_Allocator_unlock();
return MQ_OPEN_FAILED;
diff --git a/cpukit/posix/src/mqueueunlink.c b/cpukit/posix/src/mqueueunlink.c
index 2be096a421..d5182d21fc 100644
--- a/cpukit/posix/src/mqueueunlink.c
+++ b/cpukit/posix/src/mqueueunlink.c
@@ -18,19 +18,10 @@
#include "config.h"
#endif
-#include <stdarg.h>
-
-#include <pthread.h>
-#include <limits.h>
-#include <errno.h>
-#include <fcntl.h>
#include <mqueue.h>
-#include <rtems/system.h>
-#include <rtems/score/watchdog.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/seterr.h>
#include <rtems/posix/mqueueimpl.h>
+#include <rtems/seterr.h>
/*
* 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
@@ -40,31 +31,21 @@ int mq_unlink(
const char *name
)
{
- int status;
- POSIX_Message_queue_Control *the_mq;
- Objects_Id the_mq_id;
- size_t name_len;
+ POSIX_Message_queue_Control *the_mq;
+ Objects_Get_by_name_error error;
_Objects_Allocator_lock();
- _Thread_Disable_dispatch();
- status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id, &name_len );
- if ( status != 0 ) {
- _Thread_Enable_dispatch();
+ the_mq = _POSIX_Message_queue_Get_by_name( name, NULL, &error );
+ if ( the_mq == NULL ) {
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_minus_one( status );
- }
-
- the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
- &_POSIX_Message_queue_Information,
- _Objects_Get_index( the_mq_id )
- );
+ rtems_set_errno_and_return_minus_one( _POSIX_Get_by_name_error( error ) );
+ }
the_mq->linked = false;
_POSIX_Message_queue_Namespace_remove( the_mq );
_POSIX_Message_queue_Delete( the_mq );
- _Thread_Enable_dispatch();
- _Objects_Allocator_unlock();
+ _Objects_Allocator_unlock();
return 0;
}
diff --git a/cpukit/posix/src/psxnametoid.c b/cpukit/posix/src/psxnametoid.c
index 637de91212..eac8e84611 100644
--- a/cpukit/posix/src/psxnametoid.c
+++ b/cpukit/posix/src/psxnametoid.c
@@ -20,44 +20,10 @@
#include <rtems/posix/posixapi.h>
-#include <string.h>
-#include <limits.h>
#include <errno.h>
-/* pure ANSI mode does not have this prototype */
-size_t strnlen(const char *, size_t);
-
-int _POSIX_Name_to_id(
- Objects_Information *information,
- const char *name,
- Objects_Id *id,
- size_t *len
-)
-{
- int eno = EINVAL;
- size_t n = 0;
-
- if ( name != NULL && name [0] != '\0' ) {
- n = strnlen( name, NAME_MAX );
-
- if ( n < NAME_MAX ) {
- Objects_Name_or_id_lookup_errors status = _Objects_Name_to_id_string(
- information,
- name,
- id
- );
-
- if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) {
- eno = 0;
- } else {
- eno = ENOENT;
- }
- } else {
- eno = ENAMETOOLONG;
- }
- }
-
- *len = n;
-
- return eno;
-}
+const int _POSIX_Get_by_name_error_table[ 3 ] = {
+ EINVAL,
+ ENAMETOOLONG,
+ ENOENT
+};
diff --git a/cpukit/posix/src/semopen.c b/cpukit/posix/src/semopen.c
index fe0dbebe7f..b844b08bb4 100644
--- a/cpukit/posix/src/semopen.c
+++ b/cpukit/posix/src/semopen.c
@@ -60,10 +60,9 @@ sem_t *sem_open(
va_list arg;
unsigned int value = 0;
int status;
- Objects_Id the_semaphore_id;
POSIX_Semaphore_Control *the_semaphore;
- Objects_Locations location;
size_t name_len;
+ Objects_Get_by_name_error error;
if ( oflag & O_CREAT ) {
va_start(arg, oflag);
@@ -73,7 +72,7 @@ sem_t *sem_open(
}
_Objects_Allocator_lock();
- status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id, &name_len );
+ the_semaphore = _POSIX_Semaphore_Get_by_name( name, &name_len, &error );
/*
* If the name to id translation worked, then the semaphore exists
@@ -82,16 +81,19 @@ sem_t *sem_open(
* or some other miscellaneous error on the name.
*/
- if ( status ) {
+ if ( the_semaphore == NULL ) {
/*
* Unless provided a valid name that did not already exist
* and we are willing to create then it is an error.
*/
- if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
+ if ( !( error == OBJECTS_GET_BY_NAME_NO_OBJECT && (oflag & O_CREAT) ) ) {
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_value( status, SEM_FAILED );
+ rtems_set_errno_and_return_value(
+ _POSIX_Get_by_name_error( error ),
+ SEM_FAILED
+ );
}
} else {
@@ -104,9 +106,7 @@ sem_t *sem_open(
rtems_set_errno_and_return_value( EEXIST, SEM_FAILED );
}
- the_semaphore = _POSIX_Semaphore_Get( (sem_t *) &the_semaphore_id, &location );
the_semaphore->open_count += 1;
- _Thread_Enable_dispatch();
_Objects_Allocator_unlock();
goto return_id;
}
@@ -130,7 +130,7 @@ sem_t *sem_open(
_Objects_Allocator_unlock();
- if ( status == -1 )
+ if ( status != 0 )
return SEM_FAILED;
return_id:
diff --git a/cpukit/posix/src/semunlink.c b/cpukit/posix/src/semunlink.c
index 863d25801d..b8406185d4 100644
--- a/cpukit/posix/src/semunlink.c
+++ b/cpukit/posix/src/semunlink.c
@@ -18,15 +18,8 @@
#include "config.h"
#endif
-#include <stdarg.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
#include <semaphore.h>
-#include <limits.h>
-#include <rtems/system.h>
#include <rtems/posix/semaphoreimpl.h>
#include <rtems/seterr.h>
@@ -34,32 +27,21 @@ int sem_unlink(
const char *name
)
{
- int status;
- POSIX_Semaphore_Control *the_semaphore;
- Objects_Id the_semaphore_id;
- size_t name_len;
+ POSIX_Semaphore_Control *the_semaphore;
+ Objects_Get_by_name_error error;
_Objects_Allocator_lock();
- _Thread_Disable_dispatch();
- status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id, &name_len );
- if ( status != 0 ) {
- _Thread_Enable_dispatch();
+ the_semaphore = _POSIX_Semaphore_Get_by_name( name, NULL, &error );
+ if ( the_semaphore == NULL ) {
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_minus_one( status );
+ rtems_set_errno_and_return_minus_one( _POSIX_Get_by_name_error( error ) );
}
- the_semaphore = (POSIX_Semaphore_Control *) _Objects_Get_local_object(
- &_POSIX_Semaphore_Information,
- _Objects_Get_index( the_semaphore_id )
- );
-
the_semaphore->linked = false;
_POSIX_Semaphore_Namespace_remove( the_semaphore );
_POSIX_Semaphore_Delete( the_semaphore );
- _Thread_Enable_dispatch();
_Objects_Allocator_unlock();
-
return 0;
}
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index fb2aca8408..f75ae59c0f 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -448,25 +448,31 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
);
#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
+typedef enum {
+ OBJECTS_GET_BY_NAME_INVALID_NAME,
+ OBJECTS_GET_BY_NAME_NAME_TOO_LONG,
+ OBJECTS_GET_BY_NAME_NO_OBJECT
+} Objects_Get_by_name_error;
+
/**
- * @brief Converts an object name to an Id.
+ * @brief Gets an object control block identified by its name.
*
- * This method converts an object name to an Id. It performs a look up
- * using the object information block for this object class.
+ * The object information must use string names.
*
- * @param[in] information points to an object class information block.
- * @param[in] name is the name of the object to find.
- * @param[in] id will contain the Id if the search is successful.
+ * @param information The object information. Must not be NULL.
+ * @param name The object name.
+ * @param name_length_p Optional parameter to return the name length.
+ * @param error The error indication in case of failure. Must not be NULL.
*
- * @retval This method returns one of the values from the
- * @ref Objects_Name_or_id_lookup_errors enumeration to indicate
- * successful or failure. On success @a id will contain the Id of
- * the requested object.
+ * @retval NULL No object exists for this name or invalid parameters.
+ * @retval other The first object according to object index associated with
+ * this name.
*/
-Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
- Objects_Information *information,
- const char *name,
- Objects_Id *id
+Objects_Control *_Objects_Get_by_name(
+ const Objects_Information *information,
+ const char *name,
+ size_t *name_length_p,
+ Objects_Get_by_name_error *error
);
#endif
@@ -1054,6 +1060,11 @@ RTEMS_INLINE_ROUTINE void _Objects_Allocator_unlock( void )
_RTEMS_Unlock_allocator();
}
+RTEMS_INLINE_ROUTINE bool _Objects_Allocator_is_owner( void )
+{
+ return _RTEMS_Allocator_is_owner();
+}
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/src/objectnametoidstring.c b/cpukit/score/src/objectnametoidstring.c
index 00c84f04d3..bd4b4a9ead 100644
--- a/cpukit/score/src/objectnametoidstring.c
+++ b/cpukit/score/src/objectnametoidstring.c
@@ -23,40 +23,53 @@
#include <string.h>
#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
-Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
- Objects_Information *information,
- const char *name,
- Objects_Id *id
+Objects_Control *_Objects_Get_by_name(
+ const Objects_Information *information,
+ const char *name,
+ size_t *name_length_p,
+ Objects_Get_by_name_error *error
)
{
- Objects_Control *the_object;
- uint32_t index;
+ size_t name_length;
+ size_t max_name_length;
+ uint32_t index;
- /* ASSERT: information->is_string == true */
+ _Assert( information->is_string );
+ _Assert( _Objects_Allocator_is_owner() );
- if ( !id )
- return OBJECTS_INVALID_ADDRESS;
+ if ( name == NULL ) {
+ *error = OBJECTS_GET_BY_NAME_INVALID_NAME;
+ return NULL;
+ }
+
+ name_length = strnlen( name, information->name_length + 1 );
+ max_name_length = information->name_length;
+ if ( name_length > max_name_length ) {
+ *error = OBJECTS_GET_BY_NAME_NAME_TOO_LONG;
+ return NULL;
+ }
+
+ if ( name_length_p != NULL ) {
+ *name_length_p = name_length;
+ }
- if ( !name )
- return OBJECTS_INVALID_NAME;
+ for ( index = 1; index <= information->maximum; index++ ) {
+ Objects_Control *the_object;
- if ( information->maximum != 0 ) {
+ the_object = information->local_table[ index ];
- for ( index = 1; index <= information->maximum; index++ ) {
- the_object = information->local_table[ index ];
- if ( !the_object )
- continue;
+ if ( the_object == NULL )
+ continue;
- if ( !the_object->name.name_p )
- continue;
+ if ( the_object->name.name_p == NULL )
+ continue;
- if (!strncmp( name, the_object->name.name_p, information->name_length)) {
- *id = the_object->id;
- return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
- }
+ if ( strncmp( name, the_object->name.name_p, max_name_length ) == 0 ) {
+ return the_object;
}
}
- return OBJECTS_INVALID_NAME;
+ *error = OBJECTS_GET_BY_NAME_NO_OBJECT;
+ return NULL;
}
#endif
diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c
index de2965a715..41cb1243aa 100644
--- a/testsuites/psxtests/psxmsgq01/init.c
+++ b/testsuites/psxtests/psxmsgq01/init.c
@@ -378,13 +378,13 @@ void validate_mq_unlink_error_codes(void)
fatal_posix_service_status( errno, EINVAL, "mq_unlink errno value");
/*
- * EINVAL - Unlink a queue with a null name
+ * ENOENT - Unlink a queue with a zero length name
*/
- puts( "Init: mq_unlink (\"\") - EINVAL" );
+ puts( "Init: mq_unlink (\"\") - ENOENT" );
status = mq_unlink( "" );
fatal_posix_service_status( status, -1, "mq_unlink error return status");
- fatal_posix_service_status( errno, EINVAL, "mq_unlink errno value");
+ fatal_posix_service_status( errno, ENOENT, "mq_unlink errno value");
}
void validate_mq_close_error_codes(void)
diff --git a/testsuites/psxtests/psxmsgq01/psxmsgq01.scn b/testsuites/psxtests/psxmsgq01/psxmsgq01.scn
index 3eb29efb43..e68ce6d698 100644
--- a/testsuites/psxtests/psxmsgq01/psxmsgq01.scn
+++ b/testsuites/psxtests/psxmsgq01/psxmsgq01.scn
@@ -1,11 +1,11 @@
-*** POSIX MESSAGE QUEUE TEST ***
+*** BEGIN OF TEST PSXMSGQ 1 ***
_______________mq_open errors
Init: mq_open - Create with maxmsg (-1) (EINVAL)
Init: mq_open - Create with msgsize (-1) (EINVAL)
Init: mq_open - Open new mq without create flag (ENOENT)
Init: mq_open - Open with too long of a name (ENAMETOOLONG)
Init: mq_open - Create an Existing mq (EEXIST)
-Init: mq_open - SUCCESSFUL
+Init: mq_open - SUCCESSFUL
Init: mq_open - system is out of resources (ENFILE)
Init: mq_close and mq_unlink (mq3...mqn) - SUCCESSFUL
Init: Open Test Queues
@@ -13,7 +13,7 @@ _______________mq_unlink errors
Init: mq_unlink - mq_unlink with too long of a name (ENAMETOOLONG)
Init: mq_unlink - A Queue not opened (ENOENT)
Init: mq_unlink (NULL) - EINVAL
-Init: mq_unlink ("") - EINVAL
+Init: mq_unlink ("") - ENOENT
_______________mq_close errors
Init: mq_close - unopened queue (EBADF)
_______________mq_unlink functionality
@@ -21,9 +21,9 @@ Init: Unlink and Open without closing SUCCESSFUL
Task1:mq_setattr - unopened queue (EBADF)
Task1:mq_setattr - NULL attributes (EINVAL)
Init: set_attr all queues to blocking
-Init: Init: mq_timedreceive - on queue Qnoblock Init: 1 sec -12131 us
-Init: Init: mq_timedreceive - on queue Qblock Init: 1 sec -11843 us
-Init: Init: mq_timedreceive - on queue Qdefault Init: 0 sec 988133 us
+Init: Init: mq_timedreceive - on queue Qnoblock Init: 1 sec -8622 us
+Init: Init: mq_timedreceive - on queue Qblock Init: 1 sec -1872 us
+Init: Init: mq_timedreceive - on queue Qdefault Init: 1 sec -1881 us
_______________mq_send errors
Init: mq_send - Closed message queue (EBADF)
Init: mq_send - Read only message queue (EBADF)
@@ -37,9 +37,9 @@ _______________mq_getattr errors
Init: mq_getattr - unopened queue (EBADF)
Init: mq_getattr - NULL attributes (EINVAL)
_______________mq_timedsend
-Init: mq_timedsend - on queue Qnoblock Init: 0 sec 77 us
-Init: mq_timedsend - on queue Qblock Init: 0 sec 988482 us
-Init: mq_timedsend - on queue Qdefault Init: 0 sec 101 us
+Init: mq_timedsend - on queue Qnoblock Init: 0 sec 127 us
+Init: mq_timedsend - on queue Qblock Init: 1 sec -9245 us
+Init: mq_timedsend - on queue Qdefault Init: 0 sec 130 us
_______________mq_receive errors
Init: mq_receive - Unopened message queue (EBADF)
Init: mq_receive - Write only queue (EBADF)
@@ -48,9 +48,9 @@ Init: Verify Queues are full
Init: Empty all Queues
Init: mq_receive - Queue is empty (EAGAIN)
_______________mq_timedreceive
-Init: Init: mq_timedreceive - on queue Qnoblock Init: 0 sec 83 us
-Init: Init: mq_timedreceive - on queue Qblock Init: 0 sec 986568 us
-Init: Init: mq_timedreceive - on queue Qdefault Init: 1 sec -11823 us
+Init: Init: mq_timedreceive - on queue Qnoblock Init: 0 sec 128 us
+Init: Init: mq_timedreceive - on queue Qblock Init: 1 sec -715 us
+Init: Init: mq_timedreceive - on queue Qdefault Init: 1 sec -1836 us
_______________mq_open functionality
_______________mq_notify
Init: mq_notify - Unopened message queue (EBADF)
@@ -70,19 +70,19 @@ Init: Verify No Signal when send
Init: mq_send - to Qnoblock msg: 12345678 priority 31
waiting on any signal for 3 seconds.
_______________multi-thread Task 1 Test
-Task_1: Fri Jan 1 00:00:17 1988
+Task_1: Fri Jan 1 00:00:18 1988
Task_1: mq_send - to Qblock msg: 12345678 priority 31
Task_1: pthread_exit
-Init: Fri Jan 1 00:00:17 1988
+Init: Fri Jan 1 00:00:18 1988
_______________multi-thread Task 2 Test
Init: Verify Queues are empty
Init: Fill Queues with messages
Init: Verify Queues are full
Init: mq_send - to Qblock msg: Last priority 32
-Task_2: Fri Jan 1 00:00:17 1988
+Task_2: Fri Jan 1 00:00:18 1988
Task_2: Verify Queues are full
Task_2: pthread_exit
-Init: Fri Jan 1 00:00:17 1988
+Init: Fri Jan 1 00:00:18 1988
Init: Verify Queues are full
Init: Empty all Queues
_______________multi-thread Task 3 Test
@@ -90,14 +90,13 @@ Init: Verify Queues are empty
Init: Fill Queues with messages
Init: Verify Queues are full
Init: mq_send - Block while thread deletes queue (EBADF)
-Task_3: Fri Jan 1 00:00:18 1988
+Task_3: Fri Jan 1 00:00:18 1988
_______________Unlink and Close All Files
Task_3: pthread_exit
_______________mq_timedout_receive
-Init: Init: verify_timedout_mq_timedreceive - on queue Qnoblock Init: 0 sec 54 us
+Init: Init: verify_timedout_mq_timedreceive - on queue Qnoblock Init: 0 sec 81 us
_______________verify_timedout_mq_timedsend
-Init: verify_timedout_mq_timedsend - on queue Qnoblock Init: 0 sec 54 us
-Init: verify_timedout_mq_timedsend - on queue Qblock Init: 0 sec 55 us
-Init: verify_timedout_mq_timedsend - on queue Qdefault Init: 0 sec 78 us
-*** END OF POSIX MESSAGE QUEUE TEST ***
-
+Init: verify_timedout_mq_timedsend - on queue Qnoblock Init: 0 sec 84 us
+Init: verify_timedout_mq_timedsend - on queue Qblock Init: 0 sec 86 us
+Init: verify_timedout_mq_timedsend - on queue Qdefault Init: 0 sec 104 us
+*** END OF TEST PSXMSGQ 1 ***
diff --git a/testsuites/psxtests/psxobj01/init.c b/testsuites/psxtests/psxobj01/init.c
index 27d32b340e..16b703ba52 100644
--- a/testsuites/psxtests/psxobj01/init.c
+++ b/testsuites/psxtests/psxobj01/init.c
@@ -29,11 +29,12 @@ rtems_task Init(
rtems_task_argument ignored
)
{
- Objects_Name_or_id_lookup_errors namerc;
- Objects_Information TestClass;
- Objects_Id id;
- char name[64];
- bool bc;
+ Objects_Get_by_name_error error;
+ Objects_Information TestClass;
+ Objects_Control *the_object;
+ char name[64];
+ size_t name_len;
+ bool bc;
TEST_BEGIN();
@@ -53,27 +54,24 @@ rtems_task Init(
#endif
);
- puts( "INIT - _Objects_Name_to_id_string - NULL name" );
- namerc = _Objects_Name_to_id_string( &TestClass, NULL, &id );
- if ( namerc != OBJECTS_INVALID_NAME ) {
- printf( "ERROR - Status = %d\n", namerc );
- rtems_test_exit(0);
- }
-
- puts( "INIT - _Objects_Name_to_id_string - NULL ID" );
- namerc = _Objects_Name_to_id_string( &TestClass, name, NULL );
- if ( namerc != OBJECTS_INVALID_ADDRESS ) {
- printf( "ERROR - Status = %d\n", namerc );
- rtems_test_exit(0);
- }
-
- puts( "INIT - _Objects_Name_to_id_string - name of non-existent object" );
+ puts( "INIT - _Objects_Get_by_name - NULL name" );
+ the_object = _Objects_Get_by_name( &TestClass, NULL, NULL, &error );
+ rtems_test_assert( the_object == NULL );
+ rtems_test_assert( error == OBJECTS_GET_BY_NAME_INVALID_NAME );
+
+ puts( "INIT - _Objects_Get_by_name - name too long" );
+ strcpy( name, "TOOOOOOOOOOOOOOOOOO LONG" );
+ the_object = _Objects_Get_by_name( &TestClass, name, NULL, &error );
+ rtems_test_assert( the_object == NULL );
+ rtems_test_assert( error == OBJECTS_GET_BY_NAME_NAME_TOO_LONG );
+
+ puts( "INIT - _Objects_Get_by_name - name of non-existent object" );
strcpy( name, "NOT FOUND" );
- namerc = _Objects_Name_to_id_string( &TestClass, name, &id );
- if ( namerc != OBJECTS_INVALID_NAME ) {
- printf( "ERROR - Status = %d\n", namerc );
- rtems_test_exit(0);
- }
+ name_len = 123;
+ the_object = _Objects_Get_by_name( &TestClass, name, &name_len, &error );
+ rtems_test_assert( the_object == NULL );
+ rtems_test_assert( error == OBJECTS_GET_BY_NAME_NO_OBJECT );
+ rtems_test_assert( name_len == 9 );
/* out of memory error ONLY when POSIX is enabled */
puts( "INIT - _Objects_Set_name fails - out of memory" );
diff --git a/testsuites/psxtests/psxobj01/psxobj01.scn b/testsuites/psxtests/psxobj01/psxobj01.scn
index 809d028eea..344820f75c 100644
--- a/testsuites/psxtests/psxobj01/psxobj01.scn
+++ b/testsuites/psxtests/psxobj01/psxobj01.scn
@@ -1,7 +1,6 @@
-*** POSIX OBJECT TEST 1 ***
-INIT - _Objects_Name_to_id_string - NULL name
-INIT - _Objects_Name_to_id_string - NULL ID
-INIT - _Objects_Name_to_id_string - name of non-existent object
+*** BEGIN OF TEST PSXOBJ 1 ***
+INIT - _Objects_Get_by_name - NULL name
+INIT - _Objects_Get_by_name - name too long
+INIT - _Objects_Get_by_name - name of non-existent object
INIT - _Objects_Set_name fails - out of memory
-Allocate_majority_of_workspace:
-*** END OF POSIX OBJECT TEST 1 ***
+*** END OF TEST PSXOBJ 1 ***
diff --git a/testsuites/psxtests/psxsem01/init.c b/testsuites/psxtests/psxsem01/init.c
index f377a4e68b..c1752f3a35 100644
--- a/testsuites/psxtests/psxsem01/init.c
+++ b/testsuites/psxtests/psxsem01/init.c
@@ -279,10 +279,10 @@ void *POSIX_Init(
fatal_posix_service_status( status, -1, "sem_unlink error return status");
fatal_posix_service_status( errno, EINVAL, "sem_unlink errno value");
- puts( "Init: sem_unlink (\"\") - EINVAL" );
+ puts( "Init: sem_unlink (\"\") - ENOENT" );
status = sem_unlink( "" );
fatal_posix_service_status( status, -1, "sem_unlink error return status");
- fatal_posix_service_status( errno, EINVAL, "sem_unlink errno value");
+ fatal_posix_service_status( errno, ENOENT, "sem_unlink errno value");
/*
* XXX - Cant' create location OBJECTS_ERROR or OBJECTS_REMOTE.
diff --git a/testsuites/psxtests/psxsem01/psxsem01.scn b/testsuites/psxtests/psxsem01/psxsem01.scn
index 70e80baf75..ad2612f998 100644
--- a/testsuites/psxtests/psxsem01/psxsem01.scn
+++ b/testsuites/psxtests/psxsem01/psxsem01.scn
@@ -1,10 +1,10 @@
-*** POSIX SEMAPHORE MANAGER TEST 1 ***
+*** BEGIN OF TEST PSXSEM 1 ***
Init: sem_init - UNSUCCESSFUL (EINVAL)
Init: sem_init - SUCCESSFUL
Init: sem_init - UNSUCCESSFUL (ENOSPC)
Init: sem_init - UNSUCCESSFUL (ENOSYS -- pshared not supported)
-Init: sem_getvalue - SUCCESSFUL
-Init: sem_getvalue - UNSUCCESSFUL
+Init: sem_getvalue - SUCCESSFUL
+Init: sem_getvalue - UNSUCCESSFUL
Init: sem_destroy - SUCCESSFUL
Init: sem_destroy - UNSUCCESSFUL (EINVAL)
Init: sem_wait - SUCCESSFUL
@@ -13,10 +13,10 @@ Init: sem_post - SUCCESSFUL
Init: sem_wait - SUCCESSFUL (after a sem_post)
Init: sem_trywait - SUCCESSFUL
Init: sem_trywait - UNSUCCESSFUL (EAGAIN)
-Init: sem_trywait - UNSUCCESSFUL (EINVAL) -- skipping
+Init: sem_trywait - UNSUCCESSFUL (EINVAL)
Init: sem_timedwait - SUCCESSFUL
Init: sem_timedwait - UNSUCCESSFUL (ETIMEDOUT)
-Init: sem_timedwait - UNSUCCESSFUL (EINVAL)
+Init: sem_timedwait - UNSUCCESSFUL (EINVAL) -- skipping
Init: sem_post - UNSUCCESSFUL (EINVAL)
Init: sem_destroy - SUCCESSFUL
Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)
@@ -34,7 +34,6 @@ Init: sem_unlink - sem1 (2) SUCCESSFUL
Init: sem_close - UNSUCCESSFUL (EINVAL)
Init: sem_unlink - UNSUCCESSFUL (ENOENT)
Init: sem_unlink (NULL) - EINVAL
-Init: sem_unlink ("") - EINVAL
+Init: sem_unlink ("") - ENOENT
Init: sem_unlink - UNSUCCESSFUL (ENOENT)
-*** END OF POSIX SEMAPHORE MANAGER TEST 1 ***
-
+*** END OF TEST PSXSEM 1 ***