forked from Imagelibrary/rtems
posix: Convert to inline function
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include <rtems/posix/semaphore.h>
|
||||
#include <rtems/posix/posixapi.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -33,6 +35,9 @@ extern "C" {
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Semaphore_Information;
|
||||
|
||||
extern const int
|
||||
_POSIX_Semaphore_Return_codes[CORE_SEMAPHORE_STATUS_LAST + 1];
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Manager_initialization
|
||||
*
|
||||
@@ -136,9 +141,20 @@ int _POSIX_Semaphore_Wait_support(
|
||||
* appropriate POSIX status values.
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_Translate_core_semaphore_return_code(
|
||||
RTEMS_INLINE_ROUTINE int
|
||||
_POSIX_Semaphore_Translate_core_semaphore_return_code(
|
||||
CORE_semaphore_Status the_semaphore_status
|
||||
);
|
||||
)
|
||||
{
|
||||
/*
|
||||
* Internal consistency check for bad status from SuperCore
|
||||
*/
|
||||
#if defined(RTEMS_DEBUG)
|
||||
if ( the_semaphore_status > CORE_SEMAPHORE_STATUS_LAST )
|
||||
return EINVAL;
|
||||
#endif
|
||||
return _POSIX_Semaphore_Return_codes[the_semaphore_status];
|
||||
}
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Allocate
|
||||
|
||||
@@ -20,25 +20,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/posix/semaphoreimpl.h>
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Translate_core_semaphore_return_code
|
||||
*
|
||||
* Input parameters:
|
||||
* the_semaphore_status - semaphore status code to translate
|
||||
*
|
||||
* Output parameters:
|
||||
* status code - translated POSIX status code
|
||||
*
|
||||
*/
|
||||
|
||||
static int _POSIX_Semaphore_Return_codes[CORE_SEMAPHORE_STATUS_LAST + 1] = {
|
||||
const int _POSIX_Semaphore_Return_codes[CORE_SEMAPHORE_STATUS_LAST + 1] = {
|
||||
0, /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
|
||||
EAGAIN, /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
|
||||
EAGAIN, /* CORE_SEMAPHORE_WAS_DELETED */
|
||||
@@ -48,18 +32,3 @@ static int _POSIX_Semaphore_Return_codes[CORE_SEMAPHORE_STATUS_LAST + 1] = {
|
||||
*/
|
||||
ENOSYS, /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
|
||||
};
|
||||
|
||||
|
||||
int _POSIX_Semaphore_Translate_core_semaphore_return_code(
|
||||
CORE_semaphore_Status the_semaphore_status
|
||||
)
|
||||
{
|
||||
/*
|
||||
* Internal consistency check for bad status from SuperCore
|
||||
*/
|
||||
#if defined(RTEMS_DEBUG)
|
||||
if ( the_semaphore_status > CORE_SEMAPHORE_STATUS_LAST )
|
||||
return EINVAL;
|
||||
#endif
|
||||
return _POSIX_Semaphore_Return_codes[the_semaphore_status];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user