Optional POSIX Message Queue initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2016-02-03 10:00:55 +01:00
parent 9871f5dc60
commit 3015ed641a
5 changed files with 32 additions and 24 deletions
+2 -21
View File
@@ -31,32 +31,13 @@ extern "C" {
* This defines the information control block used to manage
* this class of objects.
*/
POSIX_EXTERN Objects_Information _POSIX_Message_queue_Information;
extern Objects_Information _POSIX_Message_queue_Information;
/**
* The is used to manage the set of "file descriptors" associated with
* the message queues.
*/
POSIX_EXTERN Objects_Information _POSIX_Message_queue_Information_fds;
/**
* @brief Initialize message_queue manager related data structures.
*
* This routine performs the initialization necessary for this manager.
*
* @note The structure of the routines is identical to that of POSIX
* Message_queues to leave the option of having unnamed message
* queues at a future date. They are currently not part of the
* POSIX standard but unnamed message_queues are. This is also
* the reason for the apparently unnecessary tracking of
* the process_shared attribute. [In addition to the fact that
* it would be trivial to add pshared to the mq_attr structure
* and have process private message queues.]
*
* @note This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open time.
*
*/
void _POSIX_Message_queue_Manager_initialization(void);
extern Objects_Information _POSIX_Message_queue_Information_fds;
/**
* @brief POSIX Message Queue Create Support
+12 -1
View File
@@ -28,10 +28,15 @@
#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/sysinit.h>
#include <rtems/score/watchdog.h>
#include <rtems/seterr.h>
#include <rtems/posix/mqueueimpl.h>
Objects_Information _POSIX_Message_queue_Information;
Objects_Information _POSIX_Message_queue_Information_fds;
/*
* _POSIX_Message_queue_Manager_initialization
*
@@ -42,7 +47,7 @@
* Output parameters: NONE
*/
void _POSIX_Message_queue_Manager_initialization(void)
static void _POSIX_Message_queue_Manager_initialization(void)
{
_Objects_Initialize_information(
&_POSIX_Message_queue_Information, /* object information table */
@@ -76,3 +81,9 @@ void _POSIX_Message_queue_Manager_initialization(void)
#endif
);
}
RTEMS_SYSINIT_ITEM(
_POSIX_Message_queue_Manager_initialization,
RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE,
RTEMS_SYSINIT_ORDER_MIDDLE
);
-2
View File
@@ -33,7 +33,6 @@
#include <rtems/config.h>
#include <rtems/posix/barrierimpl.h>
#include <rtems/posix/config.h>
#include <rtems/posix/mqueueimpl.h>
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/rwlockimpl.h>
@@ -61,7 +60,6 @@ void _POSIX_API_Initialize(void)
_POSIX_Key_Manager_initialization();
#ifdef RTEMS_POSIX_API
_POSIX_Message_queue_Manager_initialization();
_POSIX_Semaphore_Manager_initialization();
_POSIX_Timer_Manager_initialization();
_POSIX_Barrier_Manager_initialization();
+1
View File
@@ -46,6 +46,7 @@ extern "C" {
#define RTEMS_SYSINIT_POSIX_THREADS 000361
#define RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE 000362
#define RTEMS_SYSINIT_POSIX_MUTEX 000363
#define RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE 000364
#define RTEMS_SYSINIT_POSIX_CLEANUP 00036a
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400
+17
View File
@@ -29,6 +29,7 @@
#include <rtems/extensionimpl.h>
#ifdef RTEMS_POSIX_API
#include <rtems/posix/condimpl.h>
#include <rtems/posix/mqueueimpl.h>
#include <rtems/posix/muteximpl.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/pthreadimpl.h>
@@ -92,6 +93,8 @@ typedef enum {
POSIX_CONDITION_VARIABLE_POST,
POSIX_MUTEX_PRE,
POSIX_MUTEX_POST,
POSIX_MESSAGE_QUEUE_PRE,
POSIX_MESSAGE_QUEUE_POST,
POSIX_CLEANUP_PRE,
POSIX_CLEANUP_POST,
#endif /* RTEMS_POSIX_API */
@@ -392,6 +395,18 @@ LAST(RTEMS_SYSINIT_POSIX_MUTEX)
next_step(POSIX_MUTEX_POST);
}
FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
{
assert(_POSIX_Message_queue_Information.maximum == 0);
next_step(POSIX_MESSAGE_QUEUE_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
{
assert(_POSIX_Message_queue_Information.maximum != 0);
next_step(POSIX_MESSAGE_QUEUE_POST);
}
static size_t user_extensions_pre_posix_cleanup;
FIRST(RTEMS_SYSINIT_POSIX_CLEANUP)
@@ -521,6 +536,8 @@ static void Init(rtems_task_argument arg)
#ifdef RTEMS_POSIX_API
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1