forked from Imagelibrary/rtems
posix: Update to the pthread_once changes.
Implement the reeview changes. Add a POSIX Fatal error domain. Fix confdefs.h to correctly handle the internal POSIX mutexes.
This commit is contained in:
@@ -30,6 +30,24 @@
|
|||||||
*/
|
*/
|
||||||
/**@{**/
|
/**@{**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief POSIX API Fatal domains.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
POSIX_FD_PTHREAD, /**< A pthread thread error. */
|
||||||
|
POSIX_FD_PTHREAD_ONCE /**< A pthread once error. */
|
||||||
|
} POSIX_Fatal_domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief POSIX API Fatal error.
|
||||||
|
*
|
||||||
|
* A common method of rasing a POSIX API fatal error.
|
||||||
|
*
|
||||||
|
* @param[in] domain The POSIX error domain.
|
||||||
|
* @param[in] eno The error number as defined in errno.h.
|
||||||
|
*/
|
||||||
|
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize POSIX API.
|
* @brief Initialize POSIX API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,28 +22,25 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
#include <rtems/posix/posixapi.h>
|
||||||
#include <rtems/posix/onceimpl.h>
|
#include <rtems/posix/onceimpl.h>
|
||||||
|
|
||||||
pthread_mutex_t _POSIX_Once_Lock;
|
|
||||||
|
|
||||||
void _POSIX_Once_Manager_initialization(void)
|
void _POSIX_Once_Manager_initialization(void)
|
||||||
{
|
{
|
||||||
pthread_mutexattr_t mattr;
|
pthread_mutexattr_t mattr;
|
||||||
int r;
|
int eno;
|
||||||
|
|
||||||
_POSIX_Once_Lock = PTHREAD_MUTEX_INITIALIZER;
|
_POSIX_Once_Lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
r = pthread_mutexattr_init( &mattr );
|
eno = pthread_mutexattr_init( &mattr );
|
||||||
if ( r != 0 )
|
_Assert( eno == 0 );
|
||||||
rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa0000 | r );
|
eno = pthread_mutexattr_settype( &mattr, PTHREAD_MUTEX_RECURSIVE );
|
||||||
|
_Assert( eno == 0 );
|
||||||
|
|
||||||
r = pthread_mutexattr_settype( &mattr, PTHREAD_MUTEX_RECURSIVE );
|
eno = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
|
||||||
if ( r != 0 )
|
if ( eno != 0 )
|
||||||
rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa1000 | r );
|
_POSIX_Fatal_error( POSIX_FD_PTHREAD_ONCE, eno );
|
||||||
|
|
||||||
r = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
|
eno = pthread_mutexattr_destroy( &mattr );
|
||||||
if ( r != 0 )
|
_Assert( eno == 0 );
|
||||||
rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa2000 | r );
|
|
||||||
|
|
||||||
pthread_mutexattr_destroy( &mattr );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
#include <rtems/score/wkspace.h>
|
#include <rtems/score/wkspace.h>
|
||||||
#include <rtems/posix/cancel.h>
|
#include <rtems/posix/cancel.h>
|
||||||
|
#include <rtems/posix/posixapi.h>
|
||||||
#include <rtems/posix/pthreadimpl.h>
|
#include <rtems/posix/pthreadimpl.h>
|
||||||
#include <rtems/posix/priorityimpl.h>
|
#include <rtems/posix/priorityimpl.h>
|
||||||
#include <rtems/posix/config.h>
|
#include <rtems/posix/config.h>
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
|
|
||||||
void _POSIX_Threads_Initialize_user_threads_body(void)
|
void _POSIX_Threads_Initialize_user_threads_body(void)
|
||||||
{
|
{
|
||||||
int status;
|
int eno;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t maximum;
|
uint32_t maximum;
|
||||||
posix_initialization_threads_table *user_threads;
|
posix_initialization_threads_table *user_threads;
|
||||||
@@ -60,18 +61,20 @@ void _POSIX_Threads_Initialize_user_threads_body(void)
|
|||||||
/*
|
/*
|
||||||
* There is no way for these calls to fail in this situation.
|
* There is no way for these calls to fail in this situation.
|
||||||
*/
|
*/
|
||||||
(void) pthread_attr_init( &attr );
|
eno = pthread_attr_init( &attr );
|
||||||
(void) pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
|
_Assert( eno == 0 );
|
||||||
(void) pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size);
|
eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
|
||||||
|
_Assert( eno == 0 );
|
||||||
|
eno = pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size);
|
||||||
|
_Assert( eno == 0 );
|
||||||
|
|
||||||
status = pthread_create(
|
eno = pthread_create(
|
||||||
&thread_id,
|
&thread_id,
|
||||||
&attr,
|
&attr,
|
||||||
user_threads[ index ].thread_entry,
|
user_threads[ index ].thread_entry,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if ( status )
|
if ( eno )
|
||||||
_Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, true, status );
|
_POSIX_Fatal_error( POSIX_FD_PTHREAD, eno );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#define PTHREAD_ONCE_INIT_NOT_RUN 0
|
#define PTHREAD_ONCE_INIT_NOT_RUN 0
|
||||||
#define PTHREAD_ONCE_INIT_RUNNING 1
|
#define PTHREAD_ONCE_INIT_RUNNING 1
|
||||||
#define PTHREAD_ONCE_INIT_RUN 2
|
#define PTHREAD_ONCE_INIT_COMPLETE 2
|
||||||
|
|
||||||
int pthread_once(
|
int pthread_once(
|
||||||
pthread_once_t *once_control,
|
pthread_once_t *once_control,
|
||||||
@@ -44,7 +44,7 @@ int pthread_once(
|
|||||||
if ( once_control->is_initialized != 1 )
|
if ( once_control->is_initialized != 1 )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if ( once_control->init_executed != PTHREAD_ONCE_INIT_RUN ) {
|
if ( once_control->init_executed != PTHREAD_ONCE_INIT_COMPLETE ) {
|
||||||
r = pthread_mutex_lock( &_POSIX_Once_Lock );
|
r = pthread_mutex_lock( &_POSIX_Once_Lock );
|
||||||
if ( r == 0 ) {
|
if ( r == 0 ) {
|
||||||
int rr;
|
int rr;
|
||||||
@@ -61,7 +61,7 @@ int pthread_once(
|
|||||||
case PTHREAD_ONCE_INIT_NOT_RUN:
|
case PTHREAD_ONCE_INIT_NOT_RUN:
|
||||||
once_control->init_executed = PTHREAD_ONCE_INIT_RUNNING;
|
once_control->init_executed = PTHREAD_ONCE_INIT_RUNNING;
|
||||||
(*init_routine)();
|
(*init_routine)();
|
||||||
once_control->init_executed = PTHREAD_ONCE_INIT_RUN;
|
once_control->init_executed = PTHREAD_ONCE_INIT_COMPLETE;
|
||||||
break;
|
break;
|
||||||
case PTHREAD_ONCE_INIT_RUNNING:
|
case PTHREAD_ONCE_INIT_RUNNING:
|
||||||
r = EINVAL;
|
r = EINVAL;
|
||||||
|
|||||||
@@ -953,6 +953,11 @@ const rtems_libio_helper rtems_fs_init_helper =
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zero of one returns 0 if the parameter is 0 else 1 is returned.
|
||||||
|
*/
|
||||||
|
#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a helper macro used in calculations in this file. It is used
|
* This is a helper macro used in calculations in this file. It is used
|
||||||
* to noted when an element is allocated from the RTEMS Workspace and adds
|
* to noted when an element is allocated from the RTEMS Workspace and adds
|
||||||
@@ -960,7 +965,8 @@ const rtems_libio_helper rtems_fs_init_helper =
|
|||||||
* may be applied.
|
* may be applied.
|
||||||
*/
|
*/
|
||||||
#define _Configure_From_workspace(_size) \
|
#define _Configure_From_workspace(_size) \
|
||||||
(ssize_t)((_size) + HEAP_BLOCK_HEADER_SIZE + CPU_HEAP_ALIGNMENT - 1)
|
(ssize_t) (_Configure_Zero_or_One(_size) * \
|
||||||
|
((_size) + HEAP_BLOCK_HEADER_SIZE + CPU_HEAP_ALIGNMENT - 1))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a helper macro used in stack space calculations in this file. It
|
* This is a helper macro used in stack space calculations in this file. It
|
||||||
@@ -980,7 +986,7 @@ const rtems_libio_helper rtems_fs_init_helper =
|
|||||||
* for memory usage.
|
* for memory usage.
|
||||||
*/
|
*/
|
||||||
#define _Configure_Max_Objects(_max) \
|
#define _Configure_Max_Objects(_max) \
|
||||||
rtems_resource_maximum_per_allocation(_max)
|
(_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This macro accounts for how memory for a set of configured objects is
|
* This macro accounts for how memory for a set of configured objects is
|
||||||
@@ -992,8 +998,10 @@ const rtems_libio_helper rtems_fs_init_helper =
|
|||||||
#define _Configure_Object_RAM(_number, _size) \
|
#define _Configure_Object_RAM(_number, _size) \
|
||||||
( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
|
( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
|
||||||
_Configure_From_workspace( \
|
_Configure_From_workspace( \
|
||||||
((_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
|
(_Configure_Zero_or_One(_number) * \
|
||||||
(sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) \
|
(_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
|
||||||
|
(_Configure_Zero_or_One(_number) * \
|
||||||
|
(sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *))) \
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1730,114 +1738,95 @@ const rtems_libio_helper rtems_fs_init_helper =
|
|||||||
(_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
|
(_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_THREADS 0
|
#define CONFIGURE_MAXIMUM_POSIX_THREADS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
|
#define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
|
||||||
_Configure_From_workspace(sizeof(POSIX_API_Control))
|
_Configure_From_workspace(sizeof(POSIX_API_Control))
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
|
#ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
|
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
|
|
||||||
_Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
|
||||||
|
_Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
|
#ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 0
|
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
|
|
||||||
_Configure_Object_RAM(_condvars, \
|
|
||||||
sizeof(POSIX_Condition_variables_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
|
||||||
|
_Configure_Object_RAM(_condvars, \
|
||||||
|
sizeof(POSIX_Condition_variables_Control) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_KEYS 0
|
#define CONFIGURE_MAXIMUM_POSIX_KEYS 0
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 0
|
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) 0
|
|
||||||
#else
|
#else
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
|
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
|
||||||
CONFIGURE_MAXIMUM_POSIX_KEYS \
|
CONFIGURE_MAXIMUM_POSIX_KEYS \
|
||||||
* (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS)
|
* (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS)
|
||||||
#endif
|
#endif
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
|
|
||||||
(_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
|
|
||||||
+ _Configure_From_workspace(_key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
|
||||||
|
(_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
|
||||||
|
+ _Configure_From_workspace(_key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
|
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
|
|
||||||
_Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
|
||||||
|
_Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
|
#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
|
|
||||||
_Configure_From_workspace( \
|
|
||||||
(_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
|
||||||
|
_Configure_From_workspace( \
|
||||||
|
(_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
|
#ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 0
|
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) 0
|
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS 0
|
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_fds) 0
|
|
||||||
#else
|
#else
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
|
|
||||||
_Configure_POSIX_Named_Object_RAM( \
|
|
||||||
_message_queues, sizeof(POSIX_Message_queue_Control) )
|
|
||||||
|
|
||||||
/* default to same number */
|
/* default to same number */
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
|
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
|
||||||
CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
|
CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
|
|
||||||
_Configure_Object_RAM( \
|
|
||||||
_mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
|
||||||
|
_Configure_POSIX_Named_Object_RAM( \
|
||||||
|
_message_queues, sizeof(POSIX_Message_queue_Control) )
|
||||||
|
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
|
||||||
|
_Configure_Object_RAM( \
|
||||||
|
_mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
|
#ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
|
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
|
|
||||||
_Configure_POSIX_Named_Object_RAM( \
|
|
||||||
_semaphores, sizeof(POSIX_Semaphore_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
|
||||||
|
_Configure_POSIX_Named_Object_RAM( \
|
||||||
|
_semaphores, sizeof(POSIX_Semaphore_Control) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_BARRIERS 0
|
#define CONFIGURE_MAXIMUM_POSIX_BARRIERS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
|
|
||||||
_Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
|
||||||
|
_Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 0
|
#define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
|
|
||||||
_Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
|
||||||
|
_Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
|
||||||
|
|
||||||
#ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
|
#ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 0
|
#define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 0
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) 0
|
|
||||||
#else
|
|
||||||
#define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
|
|
||||||
_Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
|
|
||||||
#endif
|
#endif
|
||||||
|
#define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
|
||||||
|
_Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
|
||||||
|
|
||||||
#ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
|
#ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
|
||||||
|
|
||||||
@@ -2578,6 +2567,7 @@ const rtems_libio_helper rtems_fs_init_helper =
|
|||||||
#ifdef RTEMS_POSIX_API
|
#ifdef RTEMS_POSIX_API
|
||||||
/* POSIX API Pieces */
|
/* POSIX API Pieces */
|
||||||
CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
|
CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
|
||||||
|
CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES +
|
||||||
CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
|
CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
|
||||||
CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
|
CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
|
||||||
CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
|
CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
|
||||||
|
|||||||
@@ -44,6 +44,13 @@
|
|||||||
#include <rtems/posix/spinlockimpl.h>
|
#include <rtems/posix/spinlockimpl.h>
|
||||||
#include <rtems/posix/time.h>
|
#include <rtems/posix/time.h>
|
||||||
|
|
||||||
|
void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno )
|
||||||
|
{
|
||||||
|
uint32_t code = ( domain << 8 ) | ( ( uint32_t ) eno & 0xffU );
|
||||||
|
|
||||||
|
_Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, false, code );
|
||||||
|
}
|
||||||
|
|
||||||
Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
|
Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
|
||||||
|
|
||||||
void _POSIX_API_Initialize(void)
|
void _POSIX_API_Initialize(void)
|
||||||
|
|||||||
@@ -20,6 +20,18 @@
|
|||||||
|
|
||||||
#include <rtems/score/todimpl.h>
|
#include <rtems/score/todimpl.h>
|
||||||
|
|
||||||
|
pthread_once_t nesting_once = PTHREAD_ONCE_INIT;
|
||||||
|
|
||||||
|
void Test_init_routine_nesting( void );
|
||||||
|
|
||||||
|
void Test_init_routine_nesting( void )
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
puts( "Test_init_routine_nesting: invoked" );
|
||||||
|
status = pthread_once( &nesting_once, Test_init_routine_nesting );
|
||||||
|
rtems_test_assert( status == EINVAL );
|
||||||
|
}
|
||||||
|
|
||||||
void *POSIX_Init(
|
void *POSIX_Init(
|
||||||
void *argument
|
void *argument
|
||||||
)
|
)
|
||||||
@@ -95,6 +107,11 @@ void *POSIX_Init(
|
|||||||
);
|
);
|
||||||
rtems_test_assert( !status );
|
rtems_test_assert( !status );
|
||||||
|
|
||||||
|
/* once nesting */
|
||||||
|
puts( "Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)" );
|
||||||
|
status = pthread_once( &nesting_once, Test_init_routine_nesting );
|
||||||
|
rtems_test_assert( !status );
|
||||||
|
|
||||||
/* create a thread */
|
/* create a thread */
|
||||||
|
|
||||||
puts( "Init: pthread_create - SUCCESSFUL" );
|
puts( "Init: pthread_create - SUCCESSFUL" );
|
||||||
|
|||||||
@@ -162,6 +162,19 @@
|
|||||||
#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
|
#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
|
||||||
(MQ_BUFFER_MEMORY + POSIX_MQ_BUFFER_MEMORY)
|
(MQ_BUFFER_MEMORY + POSIX_MQ_BUFFER_MEMORY)
|
||||||
|
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||||
|
|
||||||
|
#define CONFIGURE_MAXIMUM_DRIVERS 2
|
||||||
|
|
||||||
|
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT
|
||||||
|
|
||||||
|
static rtems_task Init(rtems_task_argument argument);
|
||||||
|
|
||||||
|
#include <rtems/confdefs.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t data [16];
|
uint64_t data [16];
|
||||||
} area;
|
} area;
|
||||||
@@ -469,7 +482,8 @@ static rtems_task Init(rtems_task_argument argument)
|
|||||||
}
|
}
|
||||||
rtems_resource_snapshot_take(&snapshot);
|
rtems_resource_snapshot_take(&snapshot);
|
||||||
rtems_test_assert(
|
rtems_test_assert(
|
||||||
snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
|
snapshot.posix_api.active_mutexes ==
|
||||||
|
(CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES)
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -543,14 +557,3 @@ static rtems_task Init(rtems_task_argument argument)
|
|||||||
|
|
||||||
rtems_test_exit(0);
|
rtems_test_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
|
||||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
|
||||||
|
|
||||||
#define CONFIGURE_MAXIMUM_DRIVERS 2
|
|
||||||
|
|
||||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
|
||||||
|
|
||||||
#define CONFIGURE_INIT
|
|
||||||
|
|
||||||
#include <rtems/confdefs.h>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user