diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-23 10:09:37 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-28 06:19:52 +0200 |
commit | 5bc7c3724fbb06d934401400ac5922bcae2c6e95 (patch) | |
tree | 7857429e00f8e495ed5ae3317c62e1a15458f374 /cpukit/score/src/coremsg.c | |
parent | score: Gather message queue control initialization (diff) | |
download | rtems-5bc7c3724fbb06d934401400ac5922bcae2c6e95.tar.bz2 |
score: Improve _CORE_message_queue_Initialize()
Return a status code and differentiate between error conditions.
Update #4007.
Diffstat (limited to 'cpukit/score/src/coremsg.c')
-rw-r--r-- | cpukit/score/src/coremsg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c index 0246a3ae77..c86f2c28e2 100644 --- a/cpukit/score/src/coremsg.c +++ b/cpukit/score/src/coremsg.c @@ -26,7 +26,7 @@ ( SIZE_MAX - sizeof( uintptr_t ) + 1 \ - sizeof( CORE_message_queue_Buffer_control ) ) -bool _CORE_message_queue_Initialize( +Status_Control _CORE_message_queue_Initialize( CORE_message_queue_Control *the_message_queue, CORE_message_queue_Disciplines discipline, uint32_t maximum_pending_messages, @@ -37,7 +37,7 @@ bool _CORE_message_queue_Initialize( /* Make sure the message size computation does not overflow */ if ( maximum_message_size > MESSAGE_SIZE_LIMIT ) { - return false; + return STATUS_MESSAGE_QUEUE_INVALID_SIZE; } buffer_size = RTEMS_ALIGN_UP( maximum_message_size, sizeof( uintptr_t ) ); @@ -48,7 +48,7 @@ bool _CORE_message_queue_Initialize( /* Make sure the memory allocation size computation does not overflow */ if ( maximum_pending_messages > SIZE_MAX / buffer_size ) { - return false; + return STATUS_MESSAGE_QUEUE_INVALID_NUMBER; } the_message_queue->message_buffers = _Workspace_Allocate( @@ -56,7 +56,7 @@ bool _CORE_message_queue_Initialize( ); if ( the_message_queue->message_buffers == NULL ) { - return false; + return STATUS_MESSAGE_QUEUE_NO_MEMORY; } the_message_queue->maximum_pending_messages = maximum_pending_messages; @@ -80,5 +80,5 @@ bool _CORE_message_queue_Initialize( buffer_size ); - return true; + return STATUS_SUCCESSFUL; } |