Changeset e7d8b58 in rtems for c/src/exec


Ignore:
Timestamp:
Jul 31, 1997, 7:01:42 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
13f09e6
Parents:
a2fa8c25
Message:

Added rtems_message_queue_get_number_pending directive.

Location:
c/src/exec/rtems
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/headers/message.h

    ra2fa8c25 re7d8b58  
    243243
    244244/*
     245 *  rtems_message_queue_get_number_pending
     246 *
     247 *  DESCRIPTION:
     248 *
     249 *  This routine implements the rtems_message_queue_get_number_pending
     250 *  directive.  This directive returns the number of pending
     251 *  messages for the message queue indicated by ID
     252 *  chain.  The number of messages pending is returned in COUNT.
     253 */
     254
     255rtems_status_code rtems_message_queue_get_number_pending(
     256  Objects_Id  id,
     257  unsigned32 *count
     258);
     259
     260
     261/*
    245262 *  _Message_queue_Submit
    246263 *
  • c/src/exec/rtems/headers/msgmp.h

    ra2fa8c25 re7d8b58  
    3535
    3636typedef enum {
    37   MESSAGE_QUEUE_MP_ANNOUNCE_CREATE     =  0,
    38   MESSAGE_QUEUE_MP_ANNOUNCE_DELETE     =  1,
    39   MESSAGE_QUEUE_MP_EXTRACT_PROXY       =  2,
    40   MESSAGE_QUEUE_MP_RECEIVE_REQUEST     =  3,
    41   MESSAGE_QUEUE_MP_RECEIVE_RESPONSE    =  4,
    42   MESSAGE_QUEUE_MP_SEND_REQUEST        =  5,
    43   MESSAGE_QUEUE_MP_SEND_RESPONSE       =  6,
    44   MESSAGE_QUEUE_MP_URGENT_REQUEST      =  7,
    45   MESSAGE_QUEUE_MP_URGENT_RESPONSE     =  8,
    46   MESSAGE_QUEUE_MP_BROADCAST_REQUEST   =  9,
    47   MESSAGE_QUEUE_MP_BROADCAST_RESPONSE  = 10,
    48   MESSAGE_QUEUE_MP_FLUSH_REQUEST       = 11,
    49   MESSAGE_QUEUE_MP_FLUSH_RESPONSE      = 12
     37  MESSAGE_QUEUE_MP_ANNOUNCE_CREATE             =  0,
     38  MESSAGE_QUEUE_MP_ANNOUNCE_DELETE             =  1,
     39  MESSAGE_QUEUE_MP_EXTRACT_PROXY               =  2,
     40  MESSAGE_QUEUE_MP_RECEIVE_REQUEST             =  3,
     41  MESSAGE_QUEUE_MP_RECEIVE_RESPONSE            =  4,
     42  MESSAGE_QUEUE_MP_SEND_REQUEST                =  5,
     43  MESSAGE_QUEUE_MP_SEND_RESPONSE               =  6,
     44  MESSAGE_QUEUE_MP_URGENT_REQUEST              =  7,
     45  MESSAGE_QUEUE_MP_URGENT_RESPONSE             =  8,
     46  MESSAGE_QUEUE_MP_BROADCAST_REQUEST           =  9,
     47  MESSAGE_QUEUE_MP_BROADCAST_RESPONSE          = 10,
     48  MESSAGE_QUEUE_MP_FLUSH_REQUEST               = 11,
     49  MESSAGE_QUEUE_MP_FLUSH_RESPONSE              = 12,
     50  MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST  = 13,
     51  MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE = 14
    5052}   Message_queue_MP_Remote_operations;
    5153
  • c/src/exec/rtems/include/rtems/rtems/message.h

    ra2fa8c25 re7d8b58  
    243243
    244244/*
     245 *  rtems_message_queue_get_number_pending
     246 *
     247 *  DESCRIPTION:
     248 *
     249 *  This routine implements the rtems_message_queue_get_number_pending
     250 *  directive.  This directive returns the number of pending
     251 *  messages for the message queue indicated by ID
     252 *  chain.  The number of messages pending is returned in COUNT.
     253 */
     254
     255rtems_status_code rtems_message_queue_get_number_pending(
     256  Objects_Id  id,
     257  unsigned32 *count
     258);
     259
     260
     261/*
    245262 *  _Message_queue_Submit
    246263 *
  • c/src/exec/rtems/include/rtems/rtems/msgmp.h

    ra2fa8c25 re7d8b58  
    3535
    3636typedef enum {
    37   MESSAGE_QUEUE_MP_ANNOUNCE_CREATE     =  0,
    38   MESSAGE_QUEUE_MP_ANNOUNCE_DELETE     =  1,
    39   MESSAGE_QUEUE_MP_EXTRACT_PROXY       =  2,
    40   MESSAGE_QUEUE_MP_RECEIVE_REQUEST     =  3,
    41   MESSAGE_QUEUE_MP_RECEIVE_RESPONSE    =  4,
    42   MESSAGE_QUEUE_MP_SEND_REQUEST        =  5,
    43   MESSAGE_QUEUE_MP_SEND_RESPONSE       =  6,
    44   MESSAGE_QUEUE_MP_URGENT_REQUEST      =  7,
    45   MESSAGE_QUEUE_MP_URGENT_RESPONSE     =  8,
    46   MESSAGE_QUEUE_MP_BROADCAST_REQUEST   =  9,
    47   MESSAGE_QUEUE_MP_BROADCAST_RESPONSE  = 10,
    48   MESSAGE_QUEUE_MP_FLUSH_REQUEST       = 11,
    49   MESSAGE_QUEUE_MP_FLUSH_RESPONSE      = 12
     37  MESSAGE_QUEUE_MP_ANNOUNCE_CREATE             =  0,
     38  MESSAGE_QUEUE_MP_ANNOUNCE_DELETE             =  1,
     39  MESSAGE_QUEUE_MP_EXTRACT_PROXY               =  2,
     40  MESSAGE_QUEUE_MP_RECEIVE_REQUEST             =  3,
     41  MESSAGE_QUEUE_MP_RECEIVE_RESPONSE            =  4,
     42  MESSAGE_QUEUE_MP_SEND_REQUEST                =  5,
     43  MESSAGE_QUEUE_MP_SEND_RESPONSE               =  6,
     44  MESSAGE_QUEUE_MP_URGENT_REQUEST              =  7,
     45  MESSAGE_QUEUE_MP_URGENT_RESPONSE             =  8,
     46  MESSAGE_QUEUE_MP_BROADCAST_REQUEST           =  9,
     47  MESSAGE_QUEUE_MP_BROADCAST_RESPONSE          = 10,
     48  MESSAGE_QUEUE_MP_FLUSH_REQUEST               = 11,
     49  MESSAGE_QUEUE_MP_FLUSH_RESPONSE              = 12,
     50  MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST  = 13,
     51  MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE = 14
    5052}   Message_queue_MP_Remote_operations;
    5153
  • c/src/exec/rtems/src/msg.c

    ra2fa8c25 re7d8b58  
    543543    case OBJECTS_LOCAL:
    544544      *count = _CORE_message_queue_Flush( &the_message_queue->message_queue );
     545      _Thread_Enable_dispatch();
     546      return RTEMS_SUCCESSFUL;
     547  }
     548
     549  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     550}
     551
     552/*PAGE
     553 *
     554 *  rtems_message_queue_get_number_pending
     555 *
     556 *  This directive returns the number of messages pending.
     557 *
     558 *  Input parameters:
     559 *    id    - queue id
     560 *    count - return area for count
     561 *
     562 *  Output parameters:
     563 *    count             - number of messages removed ( 0 = empty queue )
     564 *    RTEMS_SUCCESSFUL - if successful
     565 *    error code        - if unsuccessful
     566 */
     567
     568rtems_status_code rtems_message_queue_get_number_pending(
     569  Objects_Id  id,
     570  unsigned32 *count
     571)
     572{
     573  register Message_queue_Control *the_message_queue;
     574  Objects_Locations               location;
     575
     576  the_message_queue = _Message_queue_Get( id, &location );
     577  switch ( location ) {
     578    case OBJECTS_ERROR:
     579      return RTEMS_INVALID_ID;
     580    case OBJECTS_REMOTE:
     581      _Thread_Executing->Wait.return_argument = count;
     582
     583      return
     584        _Message_queue_MP_Send_request_packet(
     585          MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST,
     586          id,
     587          0,                               /* buffer not used */
     588          0,                               /* size */
     589          0,                               /* option_set not used */
     590          MPCI_DEFAULT_TIMEOUT
     591        );
     592
     593    case OBJECTS_LOCAL:
     594      *count = the_message_queue->message_queue.number_of_pending_messages;
    545595      _Thread_Enable_dispatch();
    546596      return RTEMS_SUCCESSFUL;
  • c/src/exec/rtems/src/msgmp.c

    ra2fa8c25 re7d8b58  
    7474    case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
    7575    case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
     76    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST:
     77    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE:
    7678      break;
    7779
     
    102104    case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
    103105    case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
     106    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST:
    104107
    105108      the_packet                    = _Message_queue_MP_Get_packet();
     
    121124      }
    122125
    123       if ( ! _Options_Is_no_wait(option_set))
     126      if (! _Options_Is_no_wait(option_set))
    124127          the_packet->Prefix.timeout = timeout;
    125128
     
    155158      the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
    156159
    157       if ( ! _Options_Is_no_wait(option_set))
     160      if (! _Options_Is_no_wait(option_set))
    158161          the_packet->Prefix.timeout = timeout;
    159162
     
    181184    case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
    182185    case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
     186    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE:
    183187      break;
    184188  }
     
    208212    case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
    209213    case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
     214    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE:
    210215
    211216      the_packet = ( Message_queue_MP_Packet *) the_thread->receive_packet;
     
    238243    case MESSAGE_QUEUE_MP_BROADCAST_REQUEST:
    239244    case MESSAGE_QUEUE_MP_FLUSH_REQUEST:
     245    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST:
    240246      break;
    241247
     
    285291      the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
    286292
    287       if ( ! _Thread_Is_null( the_thread ) )
     293      if (! _Thread_Is_null( the_thread ) )
    288294         _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
    289295
     
    301307      );
    302308
    303       if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
     309      if (! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
    304310        _Message_queue_MP_Send_response_packet(
    305311          MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
     
    383389    case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE:
    384390    case MESSAGE_QUEUE_MP_FLUSH_RESPONSE:
     391    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE:
    385392
    386393      the_thread = _MPCI_Process_response( the_packet_prefix );
     
    400407      _Message_queue_MP_Send_response_packet(
    401408        MESSAGE_QUEUE_MP_FLUSH_RESPONSE,
     409        the_packet->Prefix.id,
     410        _Thread_Executing
     411      );
     412      break;
     413
     414    case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST:
     415
     416      the_packet->Prefix.return_code = rtems_message_queue_get_number_pending(
     417        the_packet->Prefix.id,
     418        &the_packet->count
     419      );
     420
     421      _Message_queue_MP_Send_response_packet(
     422        MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE,
    402423        the_packet->Prefix.id,
    403424        _Thread_Executing
Note: See TracChangeset for help on using the changeset viewer.