Changeset e38cb52 in rtems


Ignore:
Timestamp:
Jan 12, 2000, 6:47:22 PM (21 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ea2c1d6
Parents:
68b05694
Message:

Debugged and yellow line tested routines.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/mqueuesendsupp.c

    r68b05694 re38cb52  
    7272      }
    7373
    74       status = _CORE_message_queue_Submit(
     74      _CORE_message_queue_Submit(
    7575        &the_mq->Message_queue,
    7676        (void *) msg_ptr,
     
    8282        NULL,
    8383#endif
    84         _POSIX_Message_queue_Priority_to_core( msg_prio )
     84        _POSIX_Message_queue_Priority_to_core( msg_prio ),
     85         (the_mq->oflag & O_NONBLOCK) ? FALSE : TRUE,
     86        timeout    /* no timeout */
    8587      );
    8688
    87       if ( status != CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL ) {
    88         _Thread_Enable_dispatch();
    89         set_errno_and_return_minus_one(
    90           _POSIX_Message_queue_Translate_core_message_queue_return_code(status)
    91         );
    92       }
     89      _Thread_Enable_dispatch();
     90      if ( !_Thread_Executing->Wait.return_code )
     91        return 0;
    9392
    94       /*
    95        *  For now, we can't do a blocking send.  So if we get here, it was
    96        *  a successful send.  The return code in the TCB won't be set by
    97        *  the SuperCore since it does not support blocking mqueue sends.
    98        */
    99 
    100 #if 1
    101       _Thread_Enable_dispatch();
    102       return 0;
    103 #else
    104       _Thread_Enable_dispatch();
    105       return _Thread_Executing->Wait.return_code;
    106 #endif
     93      set_errno_and_return_minus_one(
     94        _POSIX_Message_queue_Translate_core_message_queue_return_code(
     95          _Thread_Executing->Wait.return_code
     96        )
     97      );
    10798  }
    108 
    10999  return POSIX_BOTTOM_REACHED();
    110100}
  • c/src/exec/posix/src/mqueuesetattr.c

    r68b05694 re38cb52  
    4141{
    4242  register POSIX_Message_queue_Control *the_mq;
     43  CORE_message_queue_Control           *the_core_mq;
    4344  Objects_Locations                     location;
    4445  CORE_message_queue_Attributes        *the_mq_attr;
    4546 
     47  if ( !mqstat )
     48    set_errno_and_return_minus_one( EINVAL );
     49
    4650  the_mq = _POSIX_Message_queue_Get( mqdes, &location );
    4751  switch ( location ) {
    4852    case OBJECTS_ERROR:
    49       set_errno_and_return_minus_one( EINVAL );
     53      set_errno_and_return_minus_one( EBADF );
    5054    case OBJECTS_REMOTE:
    5155      _Thread_Dispatch();
     
    5357      set_errno_and_return_minus_one( EINVAL );
    5458    case OBJECTS_LOCAL:
     59
     60      the_core_mq = &the_mq->Message_queue;
     61
    5562      /*
    5663       *  Return the old values.
     
    6067      /* XXX should be in an inlined private routine */
    6168
    62       the_mq_attr = &the_mq->Message_queue.Attributes;
    63 
    64       omqstat->mq_flags   = the_mq->flags;
    65       omqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
    66       omqstat->mq_maxmsg  = the_mq->Message_queue.maximum_pending_messages;
    67       omqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
     69      if ( omqstat ) {
     70        omqstat->mq_flags   = the_mq->oflag;
     71        omqstat->mq_msgsize = the_core_mq->maximum_message_size;
     72        omqstat->mq_maxmsg  = the_core_mq->maximum_pending_messages;
     73        omqstat->mq_curmsgs = the_core_mq->number_of_pending_messages;
     74      }
    6875 
    6976      /*
    70        *  Ignore everything except the O_NONBLOCK bit.
     77       *  If blocking was in effect and is not now, then there
     78       *  may be threads blocked on this message queue which need
     79       *  to be unblocked to make the state of the message queue
     80       *  consistent for future use.
    7181       */
     82 
     83      the_mq_attr = &the_core_mq->Attributes;
    7284
    73       if (  mqstat->mq_flags & O_NONBLOCK )
    74         the_mq->blocking = FALSE;
    75       else
    76         the_mq->blocking = TRUE;
    77  
    78       the_mq->flags = mqstat->mq_flags;
     85      if ( !(the_mq->oflag & O_NONBLOCK) &&         /* were blocking */
     86           (mqstat->mq_flags & O_NONBLOCK) ) {      /* and now are not */
     87        _CORE_message_queue_Flush_waiting_threads( the_core_mq );
     88      }
     89      
     90      the_mq->oflag = mqstat->mq_flags;
    7991
    8092      _Thread_Enable_dispatch();
  • c/src/exec/posix/src/mqueuetranslatereturncode.c

    r68b05694 re38cb52  
    4545    case  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
    4646      return 0;
     47
     48      /*
     49       *  Bad message size
     50       */
    4751    case  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
    4852      return EMSGSIZE;
     53
     54      /*
     55       *  Queue is full of pending messages.
     56       */
    4957    case  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
    5058      return EAGAIN;
     59
     60      /*
     61       *  Out of message buffers to queue pending message
     62       */
    5163    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
    52       return ENOSYS;                  /* XXX */
     64      return ENOMEM;
     65
     66      /*
     67       *  No message available on receive poll
     68       */
    5369    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
    54       return ENOSYS;                  /* XXX */
     70      return EAGAIN;
     71
     72      /*
     73       *  Queue was deleted while thread blocked on it.
     74       */
    5575    case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
    5676      return EBADF;
     77
     78      /*
     79       *  POSIX Real-Time Extensions add timeouts to send and receive.
     80       */
    5781    case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
    58       return ENOSYS;                  /* XXX */
     82      return ETIMEDOUT;
     83
     84      /*
     85       *  RTEMS POSIX API implementation does not support multiprocessing.
     86       */
    5987    case THREAD_STATUS_PROXY_BLOCKING:
    60       return ENOSYS;                  /* XXX */
     88      return ENOSYS;
    6189  }
    62   _Internal_error_Occurred(         /* XXX */
     90  _Internal_error_Occurred(
    6391    INTERNAL_ERROR_POSIX_API,
    6492    TRUE,
  • cpukit/posix/src/mqueuesendsupp.c

    r68b05694 re38cb52  
    7272      }
    7373
    74       status = _CORE_message_queue_Submit(
     74      _CORE_message_queue_Submit(
    7575        &the_mq->Message_queue,
    7676        (void *) msg_ptr,
     
    8282        NULL,
    8383#endif
    84         _POSIX_Message_queue_Priority_to_core( msg_prio )
     84        _POSIX_Message_queue_Priority_to_core( msg_prio ),
     85         (the_mq->oflag & O_NONBLOCK) ? FALSE : TRUE,
     86        timeout    /* no timeout */
    8587      );
    8688
    87       if ( status != CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL ) {
    88         _Thread_Enable_dispatch();
    89         set_errno_and_return_minus_one(
    90           _POSIX_Message_queue_Translate_core_message_queue_return_code(status)
    91         );
    92       }
     89      _Thread_Enable_dispatch();
     90      if ( !_Thread_Executing->Wait.return_code )
     91        return 0;
    9392
    94       /*
    95        *  For now, we can't do a blocking send.  So if we get here, it was
    96        *  a successful send.  The return code in the TCB won't be set by
    97        *  the SuperCore since it does not support blocking mqueue sends.
    98        */
    99 
    100 #if 1
    101       _Thread_Enable_dispatch();
    102       return 0;
    103 #else
    104       _Thread_Enable_dispatch();
    105       return _Thread_Executing->Wait.return_code;
    106 #endif
     93      set_errno_and_return_minus_one(
     94        _POSIX_Message_queue_Translate_core_message_queue_return_code(
     95          _Thread_Executing->Wait.return_code
     96        )
     97      );
    10798  }
    108 
    10999  return POSIX_BOTTOM_REACHED();
    110100}
  • cpukit/posix/src/mqueuesetattr.c

    r68b05694 re38cb52  
    4141{
    4242  register POSIX_Message_queue_Control *the_mq;
     43  CORE_message_queue_Control           *the_core_mq;
    4344  Objects_Locations                     location;
    4445  CORE_message_queue_Attributes        *the_mq_attr;
    4546 
     47  if ( !mqstat )
     48    set_errno_and_return_minus_one( EINVAL );
     49
    4650  the_mq = _POSIX_Message_queue_Get( mqdes, &location );
    4751  switch ( location ) {
    4852    case OBJECTS_ERROR:
    49       set_errno_and_return_minus_one( EINVAL );
     53      set_errno_and_return_minus_one( EBADF );
    5054    case OBJECTS_REMOTE:
    5155      _Thread_Dispatch();
     
    5357      set_errno_and_return_minus_one( EINVAL );
    5458    case OBJECTS_LOCAL:
     59
     60      the_core_mq = &the_mq->Message_queue;
     61
    5562      /*
    5663       *  Return the old values.
     
    6067      /* XXX should be in an inlined private routine */
    6168
    62       the_mq_attr = &the_mq->Message_queue.Attributes;
    63 
    64       omqstat->mq_flags   = the_mq->flags;
    65       omqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
    66       omqstat->mq_maxmsg  = the_mq->Message_queue.maximum_pending_messages;
    67       omqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
     69      if ( omqstat ) {
     70        omqstat->mq_flags   = the_mq->oflag;
     71        omqstat->mq_msgsize = the_core_mq->maximum_message_size;
     72        omqstat->mq_maxmsg  = the_core_mq->maximum_pending_messages;
     73        omqstat->mq_curmsgs = the_core_mq->number_of_pending_messages;
     74      }
    6875 
    6976      /*
    70        *  Ignore everything except the O_NONBLOCK bit.
     77       *  If blocking was in effect and is not now, then there
     78       *  may be threads blocked on this message queue which need
     79       *  to be unblocked to make the state of the message queue
     80       *  consistent for future use.
    7181       */
     82 
     83      the_mq_attr = &the_core_mq->Attributes;
    7284
    73       if (  mqstat->mq_flags & O_NONBLOCK )
    74         the_mq->blocking = FALSE;
    75       else
    76         the_mq->blocking = TRUE;
    77  
    78       the_mq->flags = mqstat->mq_flags;
     85      if ( !(the_mq->oflag & O_NONBLOCK) &&         /* were blocking */
     86           (mqstat->mq_flags & O_NONBLOCK) ) {      /* and now are not */
     87        _CORE_message_queue_Flush_waiting_threads( the_core_mq );
     88      }
     89      
     90      the_mq->oflag = mqstat->mq_flags;
    7991
    8092      _Thread_Enable_dispatch();
  • cpukit/posix/src/mqueuetranslatereturncode.c

    r68b05694 re38cb52  
    4545    case  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
    4646      return 0;
     47
     48      /*
     49       *  Bad message size
     50       */
    4751    case  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
    4852      return EMSGSIZE;
     53
     54      /*
     55       *  Queue is full of pending messages.
     56       */
    4957    case  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
    5058      return EAGAIN;
     59
     60      /*
     61       *  Out of message buffers to queue pending message
     62       */
    5163    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
    52       return ENOSYS;                  /* XXX */
     64      return ENOMEM;
     65
     66      /*
     67       *  No message available on receive poll
     68       */
    5369    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
    54       return ENOSYS;                  /* XXX */
     70      return EAGAIN;
     71
     72      /*
     73       *  Queue was deleted while thread blocked on it.
     74       */
    5575    case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
    5676      return EBADF;
     77
     78      /*
     79       *  POSIX Real-Time Extensions add timeouts to send and receive.
     80       */
    5781    case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
    58       return ENOSYS;                  /* XXX */
     82      return ETIMEDOUT;
     83
     84      /*
     85       *  RTEMS POSIX API implementation does not support multiprocessing.
     86       */
    5987    case THREAD_STATUS_PROXY_BLOCKING:
    60       return ENOSYS;                  /* XXX */
     88      return ENOSYS;
    6189  }
    62   _Internal_error_Occurred(         /* XXX */
     90  _Internal_error_Occurred(
    6391    INTERNAL_ERROR_POSIX_API,
    6492    TRUE,
Note: See TracChangeset for help on using the changeset viewer.