Changeset 3ebd4c1 in rtems


Ignore:
Timestamp:
Jan 5, 2000, 5:13:50 PM (20 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
c5858ef
Parents:
fcd0c90
Message:

+ Changed priority to the POSIX priority type.
+ Added priority validation
+ Changed to call correct core routine.
+ Added priority conversion
+ Resolved return type problems.

Files:
2 edited

Legend:

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

    rfcd0c90 r3ebd4c1  
    2929#include <rtems/posix/time.h>
    3030
     31
    3132/*PAGE
    3233 *
     
    3839  const char         *msg_ptr,
    3940  unsigned32          msg_len,
    40   Priority_Control    msg_prio,
     41  unsigned32          msg_prio,
    4142  Watchdog_Interval   timeout
    4243)
     
    4445  register POSIX_Message_queue_Control *the_mq;
    4546  Objects_Locations                     location;
    46  
     47  CORE_message_queue_Status             status;
     48
     49  /*
     50   * Validate the priority.
     51   * XXX - Do not validate msg_prio is not less than 0.
     52   */
     53
     54  if ( msg_prio > MQ_PRIO_MAX )
     55    set_errno_and_return_minus_one( EINVAL );
     56
    4757  the_mq = _POSIX_Message_queue_Get( mqdes, &location );
     58
    4859  switch ( location ) {
    4960    case OBJECTS_ERROR:
    50       set_errno_and_return_minus_one( EINVAL );
     61      set_errno_and_return_minus_one( EBADF );
     62
    5163    case OBJECTS_REMOTE:
    5264      _Thread_Dispatch();
    5365      return POSIX_MP_NOT_IMPLEMENTED();
    5466      set_errno_and_return_minus_one( EINVAL );
     67
    5568    case OBJECTS_LOCAL:
    56       /* XXX must add support for timeout and priority */
    57       _CORE_message_queue_Send(
     69      if ( (the_mq->oflag & O_ACCMODE) == O_RDONLY ) {
     70        _Thread_Enable_dispatch();
     71        set_errno_and_return_minus_one( EBADF );
     72      }
     73
     74      status = _CORE_message_queue_Submit(
    5875        &the_mq->Message_queue,
    5976        (void *) msg_ptr,
    6077        msg_len,
    61         mqdes,
     78        mqdes,      /* mqd_t is an object id */
    6279#if defined(RTEMS_MULTIPROCESSING)
    63         NULL       /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
     80        NULL,      /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
    6481#else
    65         NULL
     82        NULL,
    6683#endif
     84        _POSIX_Message_queue_Priority_to_core( msg_prio )
    6785      );
     86
     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      }
     93
     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
    68104      _Thread_Enable_dispatch();
    69105      return _Thread_Executing->Wait.return_code;
     106#endif
    70107  }
     108
    71109  return POSIX_BOTTOM_REACHED();
    72110}
    73 
  • cpukit/posix/src/mqueuesendsupp.c

    rfcd0c90 r3ebd4c1  
    2929#include <rtems/posix/time.h>
    3030
     31
    3132/*PAGE
    3233 *
     
    3839  const char         *msg_ptr,
    3940  unsigned32          msg_len,
    40   Priority_Control    msg_prio,
     41  unsigned32          msg_prio,
    4142  Watchdog_Interval   timeout
    4243)
     
    4445  register POSIX_Message_queue_Control *the_mq;
    4546  Objects_Locations                     location;
    46  
     47  CORE_message_queue_Status             status;
     48
     49  /*
     50   * Validate the priority.
     51   * XXX - Do not validate msg_prio is not less than 0.
     52   */
     53
     54  if ( msg_prio > MQ_PRIO_MAX )
     55    set_errno_and_return_minus_one( EINVAL );
     56
    4757  the_mq = _POSIX_Message_queue_Get( mqdes, &location );
     58
    4859  switch ( location ) {
    4960    case OBJECTS_ERROR:
    50       set_errno_and_return_minus_one( EINVAL );
     61      set_errno_and_return_minus_one( EBADF );
     62
    5163    case OBJECTS_REMOTE:
    5264      _Thread_Dispatch();
    5365      return POSIX_MP_NOT_IMPLEMENTED();
    5466      set_errno_and_return_minus_one( EINVAL );
     67
    5568    case OBJECTS_LOCAL:
    56       /* XXX must add support for timeout and priority */
    57       _CORE_message_queue_Send(
     69      if ( (the_mq->oflag & O_ACCMODE) == O_RDONLY ) {
     70        _Thread_Enable_dispatch();
     71        set_errno_and_return_minus_one( EBADF );
     72      }
     73
     74      status = _CORE_message_queue_Submit(
    5875        &the_mq->Message_queue,
    5976        (void *) msg_ptr,
    6077        msg_len,
    61         mqdes,
     78        mqdes,      /* mqd_t is an object id */
    6279#if defined(RTEMS_MULTIPROCESSING)
    63         NULL       /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
     80        NULL,      /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
    6481#else
    65         NULL
     82        NULL,
    6683#endif
     84        _POSIX_Message_queue_Priority_to_core( msg_prio )
    6785      );
     86
     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      }
     93
     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
    68104      _Thread_Enable_dispatch();
    69105      return _Thread_Executing->Wait.return_code;
     106#endif
    70107  }
     108
    71109  return POSIX_BOTTOM_REACHED();
    72110}
    73 
Note: See TracChangeset for help on using the changeset viewer.