Changeset c8982e5 in rtems


Ignore:
Timestamp:
Apr 26, 2016, 7:20:31 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
f009ed0
Parents:
6741d30a
git-author:
Sebastian Huber <sebastian.huber@…> (04/26/16 19:20:31)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/02/16 05:46:15)
Message:

posix: Simplify message queues

The mq_open() function returns a descriptor to a POSIX message queue
object identified by a name. This is similar to sem_open(). In
contrast to the POSIX semaphore the POSIX message queues use a separate
object for the descriptor. This extra object is superfluous, since the
object identifier can be used directly for this purpose, just like for
the semaphores.

Update #2702.
Update #2555.

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/include/rtems/libcsupport.h

    r6741d30a rc8982e5  
    115115  uint32_t active_condition_variables;
    116116  uint32_t active_message_queues;
    117   uint32_t active_message_queue_descriptors;
    118117  uint32_t active_mutexes;
    119118  uint32_t active_rwlocks;
  • cpukit/libcsupport/src/resource_snapshot.c

    r6741d30a rc8982e5  
    7171    &_POSIX_Condition_variables_Information,
    7272    &_POSIX_Message_queue_Information,
    73     &_POSIX_Message_queue_Information_fds,
    7473    &_POSIX_Mutex_Information,
    7574    &_POSIX_RWLock_Information,
  • cpukit/posix/include/rtems/posix/config.h

    r6741d30a rc8982e5  
    9595  /**
    9696   * This field contains the maximum number of POSIX API
    97    * message queue file descriptors which are configured
    98    * for this application.
    99    *
    100    * @note There can be one or more file descriptors used with
    101    *       each message queue. This value should be greater than
    102    *       or equal to the number of message queues.
    103    */
    104   uint32_t                            maximum_message_queue_descriptors;
    105 
    106   /**
    107    * This field contains the maximum number of POSIX API
    10897   * semaphores which are configured for this application.
    10998   */
  • cpukit/posix/include/rtems/posix/mqueue.h

    r6741d30a rc8982e5  
    5959   uint32_t                    open_count;
    6060   struct sigevent             notification;
     61   int                         oflag;
    6162}  POSIX_Message_queue_Control;
    62 
    63 typedef struct {
    64    Objects_Control              Object;
    65    POSIX_Message_queue_Control *Queue;
    66    int                          oflag;
    67 } POSIX_Message_queue_Control_fd;
    6863
    6964/** @} */
  • cpukit/posix/include/rtems/posix/mqueueimpl.h

    r6741d30a rc8982e5  
    2424#include <rtems/score/coremsgimpl.h>
    2525
     26#include <rtems/seterr.h>
     27
    2628#ifdef __cplusplus
    2729extern "C" {
     
    3537
    3638/**
    37  *  The is used to manage the set of "file descriptors" associated with
    38  *  the message queues.
    39  */
    40 extern Objects_Information _POSIX_Message_queue_Information_fds;
    41 
    42 /**
    4339 * @brief Delete a POSIX Message Queue
    4440 *
     
    4743 */
    4844void _POSIX_Message_queue_Delete(
    49   POSIX_Message_queue_Control *the_mq
     45  POSIX_Message_queue_Control *the_mq,
     46  ISR_lock_Context            *lock_context
    5047);
    5148
     
    8986);
    9087
    91 /**
    92  *  @brief POSIX Message Queue Allocate
    93  *
    94  *  This function allocates a message queue control block from
    95  *  the inactive chain of free message queue control blocks.
    96  */
    97 RTEMS_INLINE_ROUTINE
    98   POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void )
     88RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *
     89  _POSIX_Message_queue_Allocate_unprotected( void )
    9990{
    10091  return (POSIX_Message_queue_Control *)
    101     _Objects_Allocate( &_POSIX_Message_queue_Information );
     92    _Objects_Allocate_unprotected( &_POSIX_Message_queue_Information );
    10293}
    10394
     
    116107
    117108
    118 /**
    119  *  @brief POSIX Message Queue Get
    120  *
    121  *  This function maps message queue IDs to message queue control blocks.
    122  *  If ID corresponds to a local message queue, then it returns
    123  *  the_mq control pointer which maps to ID and location
    124  *  is set to OBJECTS_LOCAL.  if the message queue ID is global and
    125  *  resides on a remote node, then location is set to OBJECTS_REMOTE,
    126  *  and the_message queue is undefined.  Otherwise, location is set
    127  *  to OBJECTS_ERROR and the_mq is undefined.
    128  */
    129 RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
    130   Objects_Id         id,
    131   Objects_Locations *location
     109RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get(
     110  Objects_Id        id,
     111  ISR_lock_Context *lock_context
    132112)
    133113{
    134114  return (POSIX_Message_queue_Control *)
    135     _Objects_Get( &_POSIX_Message_queue_Information, id, location );
     115    _Objects_Get_local( id, &_POSIX_Message_queue_Information, lock_context );
    136116}
    137117
     
    172152  uint32_t   the_message_queue_status
    173153);
    174  
    175 /**
    176  *  @brief POSIX Message Queue Allocate File Descriptor
    177  */
    178 RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd *
    179   _POSIX_Message_queue_Allocate_fd( void )
    180 {
    181   return (POSIX_Message_queue_Control_fd *)
    182     _Objects_Allocate( &_POSIX_Message_queue_Information_fds );
    183 }
    184  
    185 /**
    186  *  @brief POSIX Message Queue Free File Descriptor
    187  */
    188 RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free_fd (
    189   POSIX_Message_queue_Control_fd *the_mq_fd
    190 )
    191 {
    192   _Objects_Free( &_POSIX_Message_queue_Information_fds, &the_mq_fd->Object );
    193 }
    194154
    195155/**
     
    203163    &_POSIX_Message_queue_Information, &the_mq->Object );
    204164}
    205  
    206 /*
    207  *  @brief POSIX Message Queue Get File Descriptor
    208  */
    209 RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd *_POSIX_Message_queue_Get_fd (
     165
     166RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *
     167_POSIX_Message_queue_Get_interrupt_disable(
    210168  mqd_t              id,
    211   Objects_Locations *location
    212 )
    213 {
    214   return (POSIX_Message_queue_Control_fd *) _Objects_Get(
    215     &_POSIX_Message_queue_Information_fds,
    216     (Objects_Id)id,
    217     location
    218   );
    219 }
    220 
    221 RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd *
    222 _POSIX_Message_queue_Get_fd_interrupt_disable(
    223   mqd_t              id,
    224   Objects_Locations *location,
    225169  ISR_lock_Context  *lock_context
    226170)
    227171{
    228   return (POSIX_Message_queue_Control_fd *) _Objects_Get_isr_disable(
    229     &_POSIX_Message_queue_Information_fds,
    230     (Objects_Id)id,
    231     location,
     172  return (POSIX_Message_queue_Control *) _Objects_Get_local(
     173    (Objects_Id) id,
     174    &_POSIX_Message_queue_Information,
    232175    lock_context
    233176  );
  • cpukit/posix/src/mqueue.c

    r6741d30a rc8982e5  
    6262    NULL                        /* Proxy extraction support callout */
    6363  );
    64   _Objects_Initialize_information(
    65     &_POSIX_Message_queue_Information_fds,
    66     OBJECTS_POSIX_API,
    67     OBJECTS_POSIX_MESSAGE_QUEUE_FDS,
    68     Configuration_POSIX_API.maximum_message_queue_descriptors,
    69     sizeof( POSIX_Message_queue_Control_fd ),
    70                                 /* size of this object's control block */
    71     true,                       /* true if names for this object are strings */
    72     NAME_MAX,                   /* maximum length of each object's name */
    73     NULL                        /* Proxy extraction support callout */
    74   );
    7564}
    7665
  • cpukit/posix/src/mqueueclose.c

    r6741d30a rc8982e5  
    3131#endif
    3232
    33 #include <stdarg.h>
    34 
    35 #include <pthread.h>
    36 #include <limits.h>
    37 #include <errno.h>
    38 #include <fcntl.h>
    39 #include <mqueue.h>
    40 
    41 #include <rtems/system.h>
    42 #include <rtems/score/watchdog.h>
    43 #include <rtems/seterr.h>
    4433#include <rtems/posix/mqueueimpl.h>
    4534
     
    5342)
    5443{
    55   POSIX_Message_queue_Control    *the_mq;
    56   POSIX_Message_queue_Control_fd *the_mq_fd;
    57   Objects_Locations               location;
     44  POSIX_Message_queue_Control *the_mq;
     45  ISR_lock_Context             lock_context;
    5846
    5947  _Objects_Allocator_lock();
    60   the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
    61   if ( location == OBJECTS_LOCAL ) {
    62       /* OBJECTS_LOCAL:
    63        *
    64        *  First update the actual message queue to reflect this descriptor
    65        *  being disassociated.  This may result in the queue being really
    66        *  deleted.
    67        */
     48  the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
    6849
    69       the_mq = the_mq_fd->Queue;
    70       the_mq->open_count -= 1;
    71       _POSIX_Message_queue_Delete( the_mq );
     50  if ( the_mq == NULL ) {
     51    _Objects_Allocator_unlock();
     52    rtems_set_errno_and_return_minus_one( EBADF );
     53  }
    7254
    73       /*
    74        *  Now close this file descriptor.
    75        */
     55  _CORE_message_queue_Acquire_critical(
     56    &the_mq->Message_queue,
     57    &lock_context
     58  );
    7659
    77       _Objects_Close(
    78         &_POSIX_Message_queue_Information_fds, &the_mq_fd->Object );
    79       _POSIX_Message_queue_Free_fd( the_mq_fd );
     60  if ( the_mq->open_count == 0 ) {
     61    _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     62    _Objects_Allocator_unlock();
     63    rtems_set_errno_and_return_minus_one( EBADF );
     64  }
    8065
    81       _Objects_Put( &the_mq_fd->Object );
    82       _Objects_Allocator_unlock();
    83       return 0;
    84    }
     66  the_mq->open_count -= 1;
     67  _POSIX_Message_queue_Delete( the_mq, &lock_context );
    8568
    86    _Objects_Allocator_unlock();
    87 
    88    /*
    89     *  OBJECTS_REMOTE:
    90     *  OBJECTS_ERROR:
    91     */
    92    rtems_set_errno_and_return_minus_one( EBADF );
     69  _Objects_Allocator_unlock();
     70  return 0;
    9371}
  • cpukit/posix/src/mqueuedeletesupp.c

    r6741d30a rc8982e5  
    1919#endif
    2020
    21 #include <stdarg.h>
    22 
    23 #include <pthread.h>
    24 #include <limits.h>
    25 #include <errno.h>
    26 #include <fcntl.h>
    27 #include <mqueue.h>
    28 
    29 #include <rtems/system.h>
    30 #include <rtems/score/watchdog.h>
    31 #include <rtems/score/wkspace.h>
    32 #include <rtems/seterr.h>
    3321#include <rtems/posix/mqueueimpl.h>
    34 #if defined(RTEMS_DEBUG)
    35   #include <rtems/bspIo.h>
    36 #endif
    3722
    3823void _POSIX_Message_queue_Delete(
    39   POSIX_Message_queue_Control *the_mq
     24  POSIX_Message_queue_Control *the_mq,
     25  ISR_lock_Context            *lock_context
    4026)
    4127{
    42   if ( !the_mq->linked && !the_mq->open_count ) {
    43       Objects_Control *the_object = &the_mq->Object;
    44       ISR_lock_Context lock_context;
    45 
    46       #if defined(RTEMS_DEBUG)
    47         /*
    48          *  the name memory will have been freed by unlink.
    49          */
    50         if ( the_object->name.name_p ) {
    51           printk(
    52             "POSIX MQ name (%p) not freed by unlink\n",
    53             (void *)the_object->name.name_p
    54           );
    55           _Workspace_Free( (void *)the_object->name.name_p );
    56         }
    57       #endif
    58 
    59       _CORE_message_queue_Acquire( &the_mq->Message_queue, &lock_context );
    60 
    61       _Objects_Close( &_POSIX_Message_queue_Information, the_object );
    62 
    63       _CORE_message_queue_Close(
    64         &the_mq->Message_queue,
    65         NULL,        /* no MP support */
    66         0,
    67         &lock_context
    68       );
    69 
     28  if ( !the_mq->linked && the_mq->open_count == 0 ) {
     29    _CORE_message_queue_Close(
     30      &the_mq->Message_queue,
     31      NULL,        /* no MP support */
     32      0,
     33      lock_context
     34    );
    7035    _POSIX_Message_queue_Free( the_mq );
    71 
     36  } else {
     37    _CORE_message_queue_Release( &the_mq->Message_queue, lock_context );
    7238  }
    7339}
  • cpukit/posix/src/mqueuegetattr.c

    r6741d30a rc8982e5  
    3131#endif
    3232
    33 #include <stdarg.h>
    34 
    35 #include <pthread.h>
    36 #include <limits.h>
    37 #include <errno.h>
    38 #include <fcntl.h>
    39 #include <mqueue.h>
    40 
    41 #include <rtems/system.h>
    42 #include <rtems/score/watchdog.h>
    43 #include <rtems/seterr.h>
    4433#include <rtems/posix/mqueueimpl.h>
    4534
     
    5342)
    5443{
    55   POSIX_Message_queue_Control          *the_mq;
    56   POSIX_Message_queue_Control_fd       *the_mq_fd;
    57   Objects_Locations                     location;
     44  POSIX_Message_queue_Control *the_mq;
     45  ISR_lock_Context             lock_context;
    5846
    59   if ( !mqstat )
     47  if ( mqstat == NULL ) {
    6048    rtems_set_errno_and_return_minus_one( EINVAL );
    61 
    62   the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
    63   switch ( location ) {
    64 
    65     case OBJECTS_LOCAL:
    66       the_mq = the_mq_fd->Queue;
    67 
    68       /*
    69        *  Return the old values.
    70        */
    71       mqstat->mq_flags   = the_mq_fd->oflag;
    72       mqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
    73       mqstat->mq_maxmsg  = the_mq->Message_queue.maximum_pending_messages;
    74       mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
    75 
    76       _Objects_Put( &the_mq_fd->Object );
    77       return 0;
    78 
    79 #if defined(RTEMS_MULTIPROCESSING)
    80     case OBJECTS_REMOTE:
    81 #endif
    82     case OBJECTS_ERROR:
    83       break;
    8449  }
    8550
    86   rtems_set_errno_and_return_minus_one( EBADF );
     51  the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     52
     53  if ( the_mq == NULL ) {
     54    rtems_set_errno_and_return_minus_one( EBADF );
     55  }
     56
     57  _CORE_message_queue_Acquire_critical(
     58    &the_mq->Message_queue,
     59    &lock_context
     60  );
     61
     62  if ( the_mq->open_count == 0 ) {
     63    _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     64    rtems_set_errno_and_return_minus_one( EBADF );
     65  }
     66
     67  /*
     68   *  Return the old values.
     69   */
     70  mqstat->mq_flags   = the_mq->oflag;
     71  mqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
     72  mqstat->mq_maxmsg  = the_mq->Message_queue.maximum_pending_messages;
     73  mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
     74
     75  _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     76  return 0;
    8777}
  • cpukit/posix/src/mqueuenotify.c

    r6741d30a rc8982e5  
    1919#endif
    2020
    21 #include <stdarg.h>
    22 
    23 #include <pthread.h>
    24 #include <limits.h>
    25 #include <errno.h>
    26 #include <fcntl.h>
    27 #include <mqueue.h>
    28 #include <sys/types.h>
    29 #include <signal.h>
    30 
    31 #include <rtems/system.h>
    32 #include <rtems/score/watchdog.h>
    33 #include <rtems/seterr.h>
    3421#include <rtems/posix/mqueueimpl.h>
    3522
    36 /*
    37  *  _POSIX_Message_queue_Notify_handler
    38  *
    39  */
     23#include <signal.h>
    4024
    4125static void _POSIX_Message_queue_Notify_handler(
     
    6549)
    6650{
    67   POSIX_Message_queue_Control    *the_mq;
    68   POSIX_Message_queue_Control_fd *the_mq_fd;
    69   Objects_Locations               location;
     51  POSIX_Message_queue_Control *the_mq;
     52  ISR_lock_Context             lock_context;
    7053
    71   the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
    72   switch ( location ) {
     54  the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
    7355
    74     case OBJECTS_LOCAL:
    75       the_mq = the_mq_fd->Queue;
    76 
    77       if ( notification ) {
    78         if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
    79           _Objects_Put( &the_mq_fd->Object );
    80           rtems_set_errno_and_return_minus_one( EBUSY );
    81         }
    82 
    83         _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL );
    84 
    85         the_mq->notification = *notification;
    86 
    87         _CORE_message_queue_Set_notify(
    88           &the_mq->Message_queue,
    89           _POSIX_Message_queue_Notify_handler
    90         );
    91       } else {
    92 
    93         _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL );
    94 
    95       }
    96 
    97       _Objects_Put( &the_mq_fd->Object );
    98       return 0;
    99 
    100 #if defined(RTEMS_MULTIPROCESSING)
    101     case OBJECTS_REMOTE:
    102 #endif
    103     case OBJECTS_ERROR:
    104       break;
     56  if ( the_mq == NULL ) {
     57    rtems_set_errno_and_return_minus_one( EBADF );
    10558  }
    10659
    107   rtems_set_errno_and_return_minus_one( EBADF );
     60  _CORE_message_queue_Acquire_critical(
     61    &the_mq->Message_queue,
     62    &lock_context
     63  );
     64
     65  if ( the_mq->open_count == 0 ) {
     66    _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     67    rtems_set_errno_and_return_minus_one( EBADF );
     68  }
     69
     70  if ( notification != NULL ) {
     71    if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
     72      _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     73      rtems_set_errno_and_return_minus_one( EBUSY );
     74    }
     75
     76    the_mq->notification = *notification;
     77
     78    _CORE_message_queue_Set_notify(
     79      &the_mq->Message_queue,
     80      _POSIX_Message_queue_Notify_handler
     81    );
     82  } else {
     83    _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL );
     84  }
     85
     86  _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     87  return 0;
    10888}
  • cpukit/posix/src/mqueueopen.c

    r6741d30a rc8982e5  
    3131#endif
    3232
     33#include <rtems/posix/mqueueimpl.h>
     34#include <rtems/score/wkspace.h>
     35
    3336#include <stdarg.h>
    34 
    35 #include <pthread.h>
    36 #include <limits.h>
    37 #include <errno.h>
    3837#include <fcntl.h>
    39 #include <mqueue.h>
    40 
    41 #include <rtems/score/todimpl.h>
    42 #include <rtems/score/watchdog.h>
    43 #include <rtems/posix/mqueueimpl.h>
    44 #include <rtems/seterr.h>
    4538
    4639#define MQ_OPEN_FAILED ((mqd_t) -1)
    4740
    48 static int _POSIX_Message_queue_Create_support(
    49   const char                    *name_arg,
    50   size_t                         name_len,
    51   struct mq_attr                *attr_ptr,
    52   POSIX_Message_queue_Control  **message_queue
     41/*
     42 *  There is no real basis for the default values.  They will work
     43 *  but were not compared against any existing implementation for
     44 *  compatibility.  See README.mqueue for an example program we
     45 *  think will print out the defaults.  Report anything you find with it.
     46 */
     47static const struct mq_attr _POSIX_Message_queue_Default_attributes = {
     48  .mq_maxmsg = 10,
     49  .mq_msgsize = 16
     50};
     51
     52static mqd_t _POSIX_Message_queue_Create(
     53  const char           *name_arg,
     54  size_t                name_len,
     55  int                   oflag,
     56  const struct mq_attr *attr
    5357)
    5458{
    55   POSIX_Message_queue_Control   *the_mq;
    56   struct mq_attr                 attr;
    57   char                          *name;
     59  POSIX_Message_queue_Control  *the_mq;
     60  char                         *name;
    5861
    5962  /* length of name has already been validated */
    6063
    61   /*
    62    *  There is no real basis for the default values.  They will work
    63    *  but were not compared against any existing implementation for
    64    *  compatibility.  See README.mqueue for an example program we
    65    *  think will print out the defaults.  Report anything you find with it.
    66    */
    67   if ( attr_ptr == NULL ) {
    68     attr.mq_maxmsg  = 10;
    69     attr.mq_msgsize = 16;
    70   } else {
    71     if ( attr_ptr->mq_maxmsg <= 0 ){
    72       rtems_set_errno_and_return_minus_one( EINVAL );
    73     }
    74 
    75     if ( attr_ptr->mq_msgsize <= 0 ){
    76       rtems_set_errno_and_return_minus_one( EINVAL );
    77     }
    78 
    79     attr = *attr_ptr;
     64  if ( attr->mq_maxmsg <= 0 ){
     65    rtems_set_errno_and_return_value( EINVAL, MQ_OPEN_FAILED );
    8066  }
    8167
    82   the_mq = _POSIX_Message_queue_Allocate();
     68  if ( attr->mq_msgsize <= 0 ){
     69    rtems_set_errno_and_return_value( EINVAL, MQ_OPEN_FAILED );
     70  }
     71
     72  the_mq = _POSIX_Message_queue_Allocate_unprotected();
    8373  if ( !the_mq ) {
    84     _Objects_Allocator_unlock();
    85     rtems_set_errno_and_return_minus_one( ENFILE );
     74    rtems_set_errno_and_return_value( ENFILE, MQ_OPEN_FAILED );
    8675  }
    8776
     
    9382  if ( !name ) {
    9483    _POSIX_Message_queue_Free( the_mq );
    95     _Objects_Allocator_unlock();
    96     rtems_set_errno_and_return_minus_one( ENOMEM );
     84    rtems_set_errno_and_return_value( ENOMEM, MQ_OPEN_FAILED );
    9785  }
    9886
    9987  the_mq->open_count = 1;
    10088  the_mq->linked = true;
     89  the_mq->oflag = oflag;
    10190
    10291  /*
     
    10796   *        if it is a real requirement.
    10897   */
    109   if ( !_CORE_message_queue_Initialize(
    110            &the_mq->Message_queue,
    111            CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
    112            attr.mq_maxmsg,
    113            attr.mq_msgsize
    114       ) ) {
    115 
     98  if (
     99    !_CORE_message_queue_Initialize(
     100      &the_mq->Message_queue,
     101      CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
     102      attr->mq_maxmsg,
     103      attr->mq_msgsize
     104    )
     105  ) {
    116106    _POSIX_Message_queue_Free( the_mq );
    117     _Workspace_Free(name);
    118     _Objects_Allocator_unlock();
    119     rtems_set_errno_and_return_minus_one( ENOSPC );
     107    _Workspace_Free( name );
     108    rtems_set_errno_and_return_value( ENOSPC, MQ_OPEN_FAILED );
    120109  }
    121110
     
    125114    name
    126115  );
    127 
    128   *message_queue = the_mq;
    129 
    130   _Objects_Allocator_unlock();
    131   return 0;
     116  return the_mq->Object.id;
    132117}
    133118
     
    143128)
    144129{
    145   /*
    146    * mode is set but never used. GCC gives a warning for this
    147    * and we need to tell GCC not to complain. But we have to
    148    * have it because we have to work through the variable
    149    * arguments to get to attr.
    150    */
    151   mode_t                          mode RTEMS_UNUSED;
     130  POSIX_Message_queue_Control *the_mq;
     131  size_t                       name_len;
     132  Objects_Get_by_name_error    error;
     133  mqd_t                        status;
    152134
    153   va_list                         arg;
    154   struct mq_attr                 *attr = NULL;
    155   int                             status;
    156   POSIX_Message_queue_Control    *the_mq;
    157   POSIX_Message_queue_Control_fd *the_mq_fd;
    158   size_t                          name_len;
    159   Objects_Get_by_name_error       error;
    160 
    161   if ( oflag & O_CREAT ) {
    162     va_start(arg, oflag);
    163     mode = va_arg( arg, mode_t );
    164     attr = va_arg( arg, struct mq_attr * );
    165     va_end(arg);
    166   }
    167 
    168   the_mq_fd = _POSIX_Message_queue_Allocate_fd();
    169   if ( !the_mq_fd ) {
    170     _Objects_Allocator_unlock();
    171     rtems_set_errno_and_return_value( ENFILE, MQ_OPEN_FAILED );
    172   }
    173   the_mq_fd->oflag = oflag;
    174 
     135  _Objects_Allocator_lock();
    175136  the_mq = _POSIX_Message_queue_Get_by_name( name, &name_len, &error );
    176137
     
    182143   */
    183144  if ( the_mq == NULL ) {
     145    va_list               ap;
     146    const struct mq_attr *attr;
     147
    184148    /*
    185149     * Unless provided a valid name that did not already exist
    186150     * and we are willing to create then it is an error.
    187151     */
    188     if ( !( error == OBJECTS_GET_BY_NAME_NO_OBJECT && (oflag & O_CREAT) ) ) {
    189       _POSIX_Message_queue_Free_fd( the_mq_fd );
     152
     153    if ( error != OBJECTS_GET_BY_NAME_NO_OBJECT || ( oflag & O_CREAT ) == 0 ) {
    190154      _Objects_Allocator_unlock();
    191155      rtems_set_errno_and_return_value(
     
    195159    }
    196160
    197   } else {                /* name -> ID translation succeeded */
     161    va_start( ap, oflag );
     162    va_arg( ap, mode_t );
     163    attr = va_arg( ap, const struct mq_attr * );
     164    va_end( ap );
     165
     166    if ( attr == NULL ) {
     167      attr = &_POSIX_Message_queue_Default_attributes;
     168    }
     169
     170    /*
     171     *  At this point, the message queue does not exist and everything has been
     172     *  checked. We should go ahead and create a message queue.
     173     */
     174
     175    status = _POSIX_Message_queue_Create( name, name_len, oflag, attr );
     176  } else {
     177
    198178    /*
    199179     * Check for existence with creation.
    200180     */
    201     if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
    202       _POSIX_Message_queue_Free_fd( the_mq_fd );
     181
     182    if ( ( oflag & ( O_CREAT | O_EXCL ) ) == ( O_CREAT | O_EXCL ) ) {
    203183      _Objects_Allocator_unlock();
    204184      rtems_set_errno_and_return_value( EEXIST, MQ_OPEN_FAILED );
    205185    }
    206186
    207     /*
    208      * In this case we need to do an ID->pointer conversion to
    209      * check the mode.
    210      */
    211187    the_mq->open_count += 1;
    212     the_mq_fd->Queue = the_mq;
    213     _Objects_Open_string(
    214       &_POSIX_Message_queue_Information_fds,
    215       &the_mq_fd->Object,
    216       NULL
    217     );
    218     _Objects_Allocator_unlock();
    219     return the_mq_fd->Object.id;
    220 
     188    status = the_mq->Object.id;
    221189  }
    222190
    223   /*
    224    *  At this point, the message queue does not exist and everything has been
    225    *  checked. We should go ahead and create a message queue.
    226    */
    227   status = _POSIX_Message_queue_Create_support(
    228     name,
    229     name_len,
    230     attr,
    231     &the_mq
    232   );
    233 
    234   /*
    235    * errno was set by Create_support, so don't set it again.
    236    */
    237   if ( status != 0 ) {
    238     _POSIX_Message_queue_Free_fd( the_mq_fd );
    239     _Objects_Allocator_unlock();
    240     return MQ_OPEN_FAILED;
    241   }
    242 
    243   the_mq_fd->Queue = the_mq;
    244   _Objects_Open_string(
    245     &_POSIX_Message_queue_Information_fds,
    246     &the_mq_fd->Object,
    247     NULL
    248   );
    249 
    250191  _Objects_Allocator_unlock();
    251 
    252   return the_mq_fd->Object.id;
     192  return status;
    253193}
  • cpukit/posix/src/mqueuerecvsupp.c

    r6741d30a rc8982e5  
    1919#endif
    2020
    21 #include <stdarg.h>
     21#include <rtems/posix/mqueueimpl.h>
     22#include <rtems/score/threadimpl.h>
    2223
    23 #include <pthread.h>
    24 #include <limits.h>
    25 #include <errno.h>
    2624#include <fcntl.h>
    27 #include <mqueue.h>
    28 
    29 #include <rtems/system.h>
    30 #include <rtems/score/watchdog.h>
    31 #include <rtems/score/threadimpl.h>
    32 #include <rtems/seterr.h>
    33 #include <rtems/posix/mqueueimpl.h>
    3425
    3526THREAD_WAIT_QUEUE_OBJECT_ASSERT(
     
    5445)
    5546{
    56   POSIX_Message_queue_Control     *the_mq;
    57   POSIX_Message_queue_Control_fd  *the_mq_fd;
    58   Objects_Locations                location;
    59   size_t                           length_out;
    60   bool                             do_wait;
    61   Thread_Control                  *executing;
    62   ISR_lock_Context                 lock_context;
     47  POSIX_Message_queue_Control *the_mq;
     48  ISR_lock_Context             lock_context;
     49  size_t                       length_out;
     50  bool                         do_wait;
     51  Thread_Control              *executing;
    6352
    64   the_mq_fd = _POSIX_Message_queue_Get_fd_interrupt_disable(
    65     mqdes,
    66     &location,
     53  the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     54
     55  if ( the_mq == NULL ) {
     56    rtems_set_errno_and_return_minus_one( EBADF );
     57  }
     58
     59  if ( ( the_mq->oflag & O_ACCMODE ) == O_WRONLY ) {
     60    _ISR_lock_ISR_enable( &lock_context );
     61    rtems_set_errno_and_return_minus_one( EBADF );
     62  }
     63
     64  if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
     65    _ISR_lock_ISR_enable( &lock_context );
     66    rtems_set_errno_and_return_minus_one( EMSGSIZE );
     67  }
     68
     69  /*
     70   *  Now if something goes wrong, we return a "length" of -1
     71   *  to indicate an error.
     72   */
     73
     74  length_out = -1;
     75
     76  /*
     77   *  A timed receive with a bad time will do a poll regardless.
     78   */
     79  if ( wait ) {
     80    do_wait = ( the_mq->oflag & O_NONBLOCK ) == 0;
     81  } else {
     82    do_wait = wait;
     83  }
     84
     85  _CORE_message_queue_Acquire_critical(
     86    &the_mq->Message_queue,
    6787    &lock_context
    6888  );
    69   switch ( location ) {
    7089
    71     case OBJECTS_LOCAL:
    72       if ( (the_mq_fd->oflag & O_ACCMODE) == O_WRONLY ) {
    73         _ISR_lock_ISR_enable( &lock_context );
    74         rtems_set_errno_and_return_minus_one( EBADF );
    75       }
    76 
    77       the_mq = the_mq_fd->Queue;
    78 
    79       if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
    80         _ISR_lock_ISR_enable( &lock_context );
    81         rtems_set_errno_and_return_minus_one( EMSGSIZE );
    82       }
    83 
    84       /*
    85        *  Now if something goes wrong, we return a "length" of -1
    86        *  to indicate an error.
    87        */
    88 
    89       length_out = -1;
    90 
    91       /*
    92        *  A timed receive with a bad time will do a poll regardless.
    93        */
    94       if ( wait )
    95         do_wait = (the_mq_fd->oflag & O_NONBLOCK) ? false : true;
    96       else
    97         do_wait = wait;
    98 
    99       _CORE_message_queue_Acquire_critical(
    100         &the_mq->Message_queue,
    101         &lock_context
    102       );
    103 
    104       /*
    105        *  Now perform the actual message receive
    106        */
    107       executing = _Thread_Executing;
    108       _CORE_message_queue_Seize(
    109         &the_mq->Message_queue,
    110         executing,
    111         mqdes,
    112         msg_ptr,
    113         &length_out,
    114         do_wait,
    115         timeout,
    116         &lock_context
    117       );
    118 
    119       if (msg_prio) {
    120         *msg_prio = _POSIX_Message_queue_Priority_from_core(
    121              executing->Wait.count
    122           );
    123       }
    124 
    125       if ( !executing->Wait.return_code )
    126         return length_out;
    127 
    128       rtems_set_errno_and_return_minus_one(
    129         _POSIX_Message_queue_Translate_core_message_queue_return_code(
    130           executing->Wait.return_code
    131         )
    132       );
    133 
    134 #if defined(RTEMS_MULTIPROCESSING)
    135     case OBJECTS_REMOTE:
    136 #endif
    137     case OBJECTS_ERROR:
    138       break;
     90  if ( the_mq->open_count == 0 ) {
     91    _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     92    rtems_set_errno_and_return_minus_one( EBADF );
    13993  }
    14094
    141   rtems_set_errno_and_return_minus_one( EBADF );
     95  /*
     96   *  Now perform the actual message receive
     97   */
     98  executing = _Thread_Executing;
     99  _CORE_message_queue_Seize(
     100    &the_mq->Message_queue,
     101    executing,
     102    mqdes,
     103    msg_ptr,
     104    &length_out,
     105    do_wait,
     106    timeout,
     107    &lock_context
     108  );
     109
     110  if ( msg_prio != NULL ) {
     111    *msg_prio = _POSIX_Message_queue_Priority_from_core(
     112      executing->Wait.count
     113    );
     114  }
     115
     116  if ( executing->Wait.return_code != CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL ) {
     117    rtems_set_errno_and_return_minus_one(
     118      _POSIX_Message_queue_Translate_core_message_queue_return_code(
     119        executing->Wait.return_code
     120      )
     121    );
     122  }
     123
     124  return length_out;
    142125}
  • cpukit/posix/src/mqueuesendsupp.c

    r6741d30a rc8982e5  
    3131#endif
    3232
    33 #include <stdarg.h>
    34 
    35 #include <pthread.h>
    36 #include <limits.h>
    37 #include <errno.h>
    38 #include <fcntl.h>
    39 #include <mqueue.h>
    40 
    41 #include <rtems/system.h>
    42 #include <rtems/score/watchdog.h>
    43 #include <rtems/seterr.h>
    4433#include <rtems/posix/mqueueimpl.h>
    4534
    46 
    47 /*
    48  *  _POSIX_Message_queue_Send_support
    49  */
     35#include <fcntl.h>
    5036
    5137int _POSIX_Message_queue_Send_support(
     
    5844)
    5945{
    60   POSIX_Message_queue_Control    *the_mq;
    61   POSIX_Message_queue_Control_fd *the_mq_fd;
    62   Objects_Locations               location;
    63   CORE_message_queue_Status       msg_status;
    64   bool                            do_wait;
    65   Thread_Control                 *executing;
    66   ISR_lock_Context                lock_context;
     46  POSIX_Message_queue_Control *the_mq;
     47  ISR_lock_Context             lock_context;
     48  CORE_message_queue_Status    msg_status;
     49  bool                         do_wait;
     50  Thread_Control              *executing;
    6751
    6852  /*
     
    7155   */
    7256
    73   if ( msg_prio > MQ_PRIO_MAX )
     57  if ( msg_prio > MQ_PRIO_MAX ) {
    7458    rtems_set_errno_and_return_minus_one( EINVAL );
     59  }
    7560
    76   the_mq_fd = _POSIX_Message_queue_Get_fd_interrupt_disable(
    77     mqdes,
    78     &location,
     61  the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     62
     63  if ( the_mq == NULL ) {
     64    rtems_set_errno_and_return_minus_one( EBADF );
     65  }
     66
     67  if ( ( the_mq->oflag & O_ACCMODE ) == O_RDONLY ) {
     68    _ISR_lock_ISR_enable( &lock_context );
     69    rtems_set_errno_and_return_minus_one( EBADF );
     70  }
     71
     72  /*
     73   *  A timed receive with a bad time will do a poll regardless.
     74   */
     75  if ( wait ) {
     76    do_wait = ( the_mq->oflag & O_NONBLOCK ) == 0;
     77  } else {
     78    do_wait = wait;
     79  }
     80
     81  _CORE_message_queue_Acquire_critical(
     82    &the_mq->Message_queue,
    7983    &lock_context
    8084  );
    81   switch ( location ) {
    8285
    83     case OBJECTS_LOCAL:
    84       if ( (the_mq_fd->oflag & O_ACCMODE) == O_RDONLY ) {
    85         _ISR_lock_ISR_enable( &lock_context );
    86         rtems_set_errno_and_return_minus_one( EBADF );
    87       }
    88 
    89       the_mq = the_mq_fd->Queue;
    90 
    91       /*
    92        *  A timed receive with a bad time will do a poll regardless.
    93        */
    94       if ( wait )
    95         do_wait = (the_mq_fd->oflag & O_NONBLOCK) ? false : true;
    96       else
    97         do_wait = wait;
    98 
    99       _CORE_message_queue_Acquire_critical(
    100         &the_mq->Message_queue,
    101         &lock_context
    102       );
    103 
    104       /*
    105        *  Now perform the actual message receive
    106        */
    107       executing = _Thread_Executing;
    108       msg_status = _CORE_message_queue_Submit(
    109         &the_mq->Message_queue,
    110         executing,
    111         msg_ptr,
    112         msg_len,
    113         NULL,
    114         0,
    115         _POSIX_Message_queue_Priority_to_core( msg_prio ),
    116         do_wait,
    117         timeout,   /* no timeout */
    118         &lock_context
    119       );
    120 
    121       /*
    122        *  If we had to block, then this is where the task returns
    123        *  after it wakes up.  The returned status is correct for
    124        *  non-blocking operations but if we blocked, then we need
    125        *  to look at the status in our TCB.
    126        */
    127 
    128       if ( msg_status == CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT )
    129         msg_status = executing->Wait.return_code;
    130 
    131       if ( !msg_status )
    132         return msg_status;
    133 
    134       rtems_set_errno_and_return_minus_one(
    135         _POSIX_Message_queue_Translate_core_message_queue_return_code(
    136           msg_status
    137         )
    138       );
    139 
    140 #if defined(RTEMS_MULTIPROCESSING)
    141     case OBJECTS_REMOTE:
    142 #endif
    143     case OBJECTS_ERROR:
    144       break;
     86  if ( the_mq->open_count == 0 ) {
     87    _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     88    rtems_set_errno_and_return_minus_one( EBADF );
    14589  }
    14690
    147   rtems_set_errno_and_return_minus_one( EBADF );
     91  /*
     92   *  Now perform the actual message receive
     93   */
     94  executing = _Thread_Executing;
     95  msg_status = _CORE_message_queue_Submit(
     96    &the_mq->Message_queue,
     97    executing,
     98    msg_ptr,
     99    msg_len,
     100    NULL,
     101    0,
     102    _POSIX_Message_queue_Priority_to_core( msg_prio ),
     103    do_wait,
     104    timeout,
     105    &lock_context
     106  );
     107
     108  /*
     109   *  If we had to block, then this is where the task returns
     110   *  after it wakes up.  The returned status is correct for
     111   *  non-blocking operations but if we blocked, then we need
     112   *  to look at the status in our TCB.
     113   */
     114
     115  if ( msg_status == CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT ) {
     116    msg_status = executing->Wait.return_code;
     117  }
     118
     119  if ( msg_status != CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL ) {
     120    rtems_set_errno_and_return_minus_one(
     121      _POSIX_Message_queue_Translate_core_message_queue_return_code(
     122        msg_status
     123      )
     124    );
     125  }
     126
     127  return 0;
    148128}
  • cpukit/posix/src/mqueuesetattr.c

    r6741d30a rc8982e5  
    1919#endif
    2020
    21 #include <stdarg.h>
    22 
    23 #include <pthread.h>
    24 #include <limits.h>
    25 #include <errno.h>
    26 #include <fcntl.h>
    27 #include <mqueue.h>
    28 
    29 #include <rtems/system.h>
    30 #include <rtems/score/watchdog.h>
    31 #include <rtems/seterr.h>
    3221#include <rtems/posix/mqueueimpl.h>
    3322
     
    3827)
    3928{
    40   POSIX_Message_queue_Control_fd *the_mq_fd;
    41   CORE_message_queue_Control     *the_core_mq;
    42   Objects_Locations               location;
     29  POSIX_Message_queue_Control *the_mq;
     30  ISR_lock_Context             lock_context;
    4331
    44   if ( !mqstat )
     32  if ( mqstat == NULL ) {
    4533    rtems_set_errno_and_return_minus_one( EINVAL );
    46 
    47   the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
    48   switch ( location ) {
    49 
    50     case OBJECTS_LOCAL:
    51 
    52       the_core_mq = &the_mq_fd->Queue->Message_queue;
    53 
    54       /*
    55        *  Return the old values.
    56        */
    57 
    58       if ( omqstat ) {
    59         omqstat->mq_flags   = the_mq_fd->oflag;
    60         omqstat->mq_msgsize = the_core_mq->maximum_message_size;
    61         omqstat->mq_maxmsg  = the_core_mq->maximum_pending_messages;
    62         omqstat->mq_curmsgs = the_core_mq->number_of_pending_messages;
    63       }
    64 
    65       the_mq_fd->oflag = mqstat->mq_flags;
    66       _Objects_Put( &the_mq_fd->Object );
    67       return 0;
    68 
    69 #if defined(RTEMS_MULTIPROCESSING)
    70     case OBJECTS_REMOTE:
    71 #endif
    72     case OBJECTS_ERROR:
    73       break;
    7434  }
    7535
    76   rtems_set_errno_and_return_minus_one( EBADF );
     36  the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     37
     38  if ( the_mq == NULL ) {
     39    rtems_set_errno_and_return_minus_one( EBADF );
     40  }
     41
     42  _CORE_message_queue_Acquire_critical(
     43    &the_mq->Message_queue,
     44    &lock_context
     45  );
     46
     47  if ( the_mq->open_count == 0 ) {
     48    _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     49    rtems_set_errno_and_return_minus_one( EBADF );
     50  }
     51
     52  /*
     53   *  Return the old values.
     54   */
     55
     56  if ( omqstat != NULL ) {
     57    omqstat->mq_flags   = the_mq->oflag;
     58    omqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
     59    omqstat->mq_maxmsg  = the_mq->Message_queue.maximum_pending_messages;
     60    omqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
     61  }
     62
     63  the_mq->oflag = mqstat->mq_flags;
     64
     65  _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     66  return 0;
    7767}
  • cpukit/posix/src/mqueueunlink.c

    r6741d30a rc8982e5  
    1919#endif
    2020
    21 #include <mqueue.h>
    22 
    2321#include <rtems/posix/mqueueimpl.h>
    24 #include <rtems/seterr.h>
    2522
    2623/*
     
    3431  POSIX_Message_queue_Control *the_mq;
    3532  Objects_Get_by_name_error    error;
     33  ISR_lock_Context             lock_context;
    3634
    3735  _Objects_Allocator_lock();
     
    4341  }
    4442
     43  _POSIX_Message_queue_Namespace_remove( the_mq );
     44
     45  _CORE_message_queue_Acquire( &the_mq->Message_queue, &lock_context );
     46
    4547  the_mq->linked = false;
    46   _POSIX_Message_queue_Namespace_remove( the_mq );
    47   _POSIX_Message_queue_Delete( the_mq );
     48  _POSIX_Message_queue_Delete( the_mq, &lock_context );
    4849
    4950  _Objects_Allocator_unlock();
  • cpukit/rtems/src/rtemsobjectgetapiclassname.c

    r6741d30a rc8982e5  
    4949  { "Key",                     OBJECTS_POSIX_KEYS, 0},
    5050  { "Interrupt",               OBJECTS_POSIX_INTERRUPTS, 0},
    51   { "Queued fd",               OBJECTS_POSIX_MESSAGE_QUEUE_FDS, 0},
    5251  { "Message Queue",           OBJECTS_POSIX_MESSAGE_QUEUES, 0},
    5352  { "Mutex",                   OBJECTS_POSIX_MUTEXES, 0},
  • cpukit/sapi/include/confdefs.h

    r6741d30a rc8982e5  
    20302030        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
    20312031    #endif
    2032     #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS)
    2033       #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
    2034         rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
    2035     #endif
    20362032    #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
    20372033      #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
     
    25832579
    25842580  /**
    2585    * This configuration parameter specifies the maximum number of
    2586    * POSIX API messages queue descriptors.
    2587    *
    2588    * This defaults to the number of POSIX API message queues.
    2589    */
    2590   #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
    2591      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
    2592              CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
    2593   #endif
    2594 
    2595   /**
    25962581   * This macro is calculated to specify the memory required for
    25972582   * POSIX API message queues.
     
    26022587    _Configure_POSIX_Named_Object_RAM( \
    26032588       _message_queues, sizeof(POSIX_Message_queue_Control) )
    2604 
    2605   /**
    2606    * This macro is calculated to specify the memory required for
    2607    * POSIX API message queue descriptors.
    2608    *
    2609    * This is an internal parameter.
    2610    */
    2611   #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
    2612     _Configure_Object_RAM( \
    2613        _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
    26142589
    26152590  /**
     
    29082883      CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
    29092884        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
    2910       CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS( \
    2911         CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS) + \
    29122885      CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
    29132886        CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
     
    33703343      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
    33713344      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES,
    3372       CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS,
    33733345      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES,
    33743346      CONFIGURE_MAXIMUM_POSIX_BARRIERS,
     
    37283700       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
    37293701       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
    3730        (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS != 0) || \
    37313702       (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \
    37323703       (CONFIGURE_MAXIMUM_POSIX_BARRIERS != 0) || \
     
    37963767#endif
    37973768
    3798 /*
    3799  *  If you have fewer POSIX Message Queue Descriptors than actual
    3800  *  POSIX Message Queues, then you will not be able to open all the
    3801  *  queues.
    3802  */
    3803 #if (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS < \
    3804      CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
    3805   #error "Fewer POSIX Message Queue descriptors than Queues!"
     3769#ifdef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
     3770  #warning "The CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTOR configuration option is obsolete!"
    38063771#endif
    38073772
  • cpukit/score/include/rtems/score/objectimpl.h

    r6741d30a rc8982e5  
    8787  OBJECTS_POSIX_KEYS                = 2,
    8888  OBJECTS_POSIX_INTERRUPTS          = 3,
    89   OBJECTS_POSIX_MESSAGE_QUEUE_FDS   = 4,
    9089  OBJECTS_POSIX_MESSAGE_QUEUES      = 5,
    9190  OBJECTS_POSIX_MUTEXES             = 6,
  • testsuites/psxtests/psxconfig01/init.c

    r6741d30a rc8982e5  
    131131
    132132#ifdef POSIX_MQ_COUNT
    133   #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS POSIX_MQ_COUNT
    134133  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES POSIX_MQ_COUNT
    135134
     
    502501  rtems_resource_snapshot_take(&snapshot);
    503502  rtems_test_assert(
    504     snapshot.posix_api.active_message_queue_descriptors
    505       == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
    506   );
    507   rtems_test_assert(
    508503    snapshot.posix_api.active_message_queues
    509504      == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
  • testsuites/psxtests/psxmsgq04/init.c

    r6741d30a rc8982e5  
    138138#define CONFIGURE_MAXIMUM_POSIX_THREADS                   1
    139139#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES            1
    140 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS 2
    141140
    142141#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtmtests/psxtmmq01/init.c

    r6741d30a rc8982e5  
    302302#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    303303#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES  2
    304 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS 2
    305304
    306305#define CONFIGURE_INIT
  • testsuites/sptests/spthreadq01/init.c

    r6741d30a rc8982e5  
    2626  #include <string.h>
    2727  #include <pthread.h>
    28 
    29   #include <rtems/posix/mqueueimpl.h>
    3028#endif
    3129
     
    122120  int eno;
    123121  char buf[1];
    124   POSIX_Message_queue_Control_fd *the_mq_fd;
    125   Objects_Locations location;
    126   ISR_lock_Context lock_context;
    127122
    128123  wake_up_master(ctx);
     
    162157
    163158  wake_up_master(ctx);
    164   the_mq_fd = _POSIX_Message_queue_Get_fd_interrupt_disable(
    165     ctx->pmq,
    166     &location,
    167     &lock_context
    168   );
    169   _ISR_lock_ISR_enable(&lock_context);
    170   rtems_test_assert(the_mq_fd != NULL);
    171   rtems_test_assert(location == OBJECTS_LOCAL);
    172   rtems_test_assert(get_wait_id(ctx) == the_mq_fd->Queue->Object.id);
     159  rtems_test_assert(get_wait_id(ctx) == ctx->pmq);
    173160
    174161  buf[0] = 'x';
     
    398385  #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 1
    399386  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
    400   #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS 1
    401387  #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
    402388    (2 * CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1))
Note: See TracChangeset for help on using the changeset viewer.