Ticket #1291: pr1291-47.diff

File pr1291-47.diff, 44.7 KB (added by Joel Sherrill, on Jul 24, 2008 at 7:01:30 PM)

version of patch for 4.7 branch.

  • cpukit/itron/inline/rtems/itron/semaphore.inl

    ? past472.diff
    ? cpukit/score/src/.coremsgseize.c.swp
    RCS file: /usr1/CVS/rtems/cpukit/itron/inline/rtems/itron/semaphore.inl,v
    retrieving revision 1.6.2.1
    diff -u -r1.6.2.1 semaphore.inl
     
    172172      return E_TMOUT;
    173173    case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
    174174      return E_QOVR;
    175     case CORE_SEMAPHORE_BAD_TIMEOUT_VALUE:
    176       return E_PAR;
    177175    case THREAD_STATUS_PROXY_BLOCKING:
    178176      return THREAD_STATUS_PROXY_BLOCKING;
    179177  }
  • cpukit/itron/src/twai_sem.c

    RCS file: /usr1/CVS/rtems/cpukit/itron/src/twai_sem.c,v
    retrieving revision 1.6.2.1
    diff -u -r1.6.2.1 twai_sem.c
     
    3030  TMO tmout
    3131)
    3232{
    33   ITRON_Semaphore_Control        *the_semaphore;
    34   Objects_Locations               location;
    35   Watchdog_Interval               interval;
    36   Core_semaphore_Blocking_option  blocking;
     33  ITRON_Semaphore_Control  *the_semaphore;
     34  Objects_Locations         location;
     35  Watchdog_Interval         interval;
     36  boolean                   blocking;
    3737
    3838  interval = 0;
    3939  if ( tmout == TMO_POL ) {
    40     blocking = CORE_SEMAPHORE_NO_WAIT;
     40    blocking = FALSE;
    4141  } else {
    42     blocking = CORE_SEMAPHORE_BLOCK_FOREVER;
     42    blocking = TRUE;
    4343
    4444    if ( tmout != TMO_FEVR )
    4545      interval = TOD_MILLISECONDS_TO_TICKS(tmout);
  • cpukit/posix/Makefile.am

    RCS file: /usr1/CVS/rtems/cpukit/posix/Makefile.am,v
    retrieving revision 1.35.2.1
    diff -u -r1.35.2.1 Makefile.am
     
    132132
    133133## TIME_C_FILES
    134134libposix_a_SOURCES += src/adjtime.c src/time.c src/posixtimespecsubtract.c \
    135     src/posixtimespectointerval.c src/posixintervaltotimespec.c \
    136     src/clockgetcpuclockid.c src/clockgetenableattr.c src/clockgetres.c \
    137     src/clockgettime.c src/clocksetenableattr.c src/clocksettime.c \
    138     src/nanosleep.c src/sleep.c src/usleep.c
     135    src/posixtimespecabsolutetimeout.c src/posixtimespectointerval.c \
     136    src/posixintervaltotimespec.c src/clockgetcpuclockid.c \
     137    src/clockgetenableattr.c src/clockgetres.c src/clockgettime.c \
     138    src/clocksetenableattr.c src/clocksettime.c src/nanosleep.c src/sleep.c \
     139    src/usleep.c
    139140
    140141# the timer manager needs to be split further but only after its
    141142# dependence on the Classic API Timer Manager is removed.
  • cpukit/posix/include/mqueue.h

    RCS file: /usr1/CVS/rtems/cpukit/posix/include/mqueue.h,v
    retrieving revision 1.9
    diff -u -r1.9 mqueue.h
     
    2626 *  15.1.1 Data Structures, P1003.1b-1993, p. 271
    2727 */
    2828
     29/**
     30 *  Message queue id type
     31 */
    2932typedef Objects_Id  mqd_t;
    3033
     34/**
     35 *  This is the message queue attributes structure.
     36 */
    3137struct mq_attr {
    32   long  mq_flags;     /* Message queue flags */
    33   long  mq_maxmsg;    /* Maximum number of messages */
    34   long  mq_msgsize;   /* Maximum message size */
    35   long  mq_curmsgs;   /* Number of messages currently queued */
     38  /** This is the message queue flags */
     39  long  mq_flags;
     40  /** This is the maximum number of messages */
     41  long  mq_maxmsg;
     42  /** This is the maximum message size */
     43  long  mq_msgsize;
     44  /** This is the mumber of messages currently queued */
     45  long  mq_curmsgs;
    3646};
    3747
    38 /*
     48/**
    3949 *  15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
    4050 */
    41 
    4251mqd_t mq_open(
    4352  const char *name,
    4453  int         oflag,
    4554  ...
    4655);
    4756
    48 /*
     57/**
    4958 *  15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
    5059 */
    51 
    5260int mq_close(
    5361  mqd_t  mqdes
    5462);
    5563
    56 /*
     64/**
    5765 *  15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
    5866 */
    59 
    6067int mq_unlink(
    6168  const char *name
    6269);
    6370
    64 /*
     71/**
    6572 *  15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
    6673 *
    67  *  NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
     74 *  @note P1003.4b/D8, p. 45 adds mq_timedsend().
    6875 */
    69 
    7076int mq_send(
    7177  mqd_t         mqdes,
    7278  const char   *msg_ptr,
     
    8389  const char            *msg_ptr,
    8490  size_t                 msg_len,
    8591  unsigned int           msg_prio,
    86   const struct timespec *timeout
     92  const struct timespec *abstime
    8793);
    8894
    8995#endif /* _POSIX_TIMEOUTS */
     
    108114  char                  *msg_ptr,
    109115  size_t                 msg_len,
    110116  unsigned int          *msg_prio,
    111   const struct timespec *timeout
     117  const struct timespec *abstime
    112118);
    113119
    114120#endif /* _POSIX_TIMEOUTS */
  • cpukit/posix/include/rtems/posix/mqueue.h

    RCS file: /usr1/CVS/rtems/cpukit/posix/include/rtems/posix/mqueue.h,v
    retrieving revision 1.21.2.1
    diff -u -r1.21.2.1 mqueue.h
     
    112112  char               *msg_ptr,
    113113  size_t              msg_len,
    114114  unsigned int       *msg_prio,
     115  boolean             wait,
    115116  Watchdog_Interval   timeout
    116117);
    117118
     
    128129  const char         *msg_ptr,
    129130  size_t              msg_len,
    130131  uint32_t            msg_prio,
     132  boolean             wait,
    131133  Watchdog_Interval   timeout
    132134);
    133135
  • cpukit/posix/include/rtems/posix/semaphore.h

    RCS file: /usr1/CVS/rtems/cpukit/posix/include/rtems/posix/semaphore.h,v
    retrieving revision 1.19.2.1
    diff -u -r1.19.2.1 semaphore.h
     
    153153 */
    154154
    155155int _POSIX_Semaphore_Wait_support(
    156   sem_t                          *sem,
    157   Core_semaphore_Blocking_option  blocking,
    158   Watchdog_Interval               timeout
     156  sem_t               *sem,
     157  boolean              blocking,
     158  Watchdog_Interval    timeout
    159159);
    160160
    161161/*
  • cpukit/posix/include/rtems/posix/time.h

    RCS file: /usr1/CVS/rtems/cpukit/posix/include/rtems/posix/time.h,v
    retrieving revision 1.8
    diff -u -r1.8 time.h
     
    1313
    1414#include <rtems/score/tod.h>
    1515
     16/*  Absolute Timeout Conversion Results
     17 *
     18 *  This enumeration defines the possible results of converting
     19 *  an absolute time used for timeouts to POSIX blocking calls to
     20 *  a number of ticks.
     21 */
     22typedef enum {
     23  /* The timeout is invalid. */
     24  POSIX_ABSOLUTE_TIMEOUT_INVALID,
     25  /* The timeout represents a time that is in the past. */
     26  POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST,
     27  /* The timeout represents a time that is equal to the current time. */
     28  POSIX_ABSOLUTE_TIMEOUT_IS_NOW,
     29  /* The timeout represents a time that is in the future. */
     30  POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE,
     31} POSIX_Absolute_timeout_conversion_results_t;
     32
    1633/*
    1734 *  Seconds from January 1, 1970 to January 1, 1988.  Used to account for
    1835 *  differences between POSIX API and RTEMS core.
     
    5168  struct timespec   *time
    5269);
    5370
     71/*
     72 *  Convert Absolute Timeout to Ticks
     73 *
     74 *  This method takes an absolute time being used as a timeout
     75 *  to a blocking directive, validates it and returns the number
     76 *  of corresponding clock ticks for use by the SuperCore.
     77 *
     78 *  abstime   - is the timeout
     79 *  ticks_out -  will contain the number of ticks
     80 *
     81 *  This method returns the number of ticks in @a ticks_out
     82 *  and a status value indicating whether the absolute time
     83 *  is valid, in the past, equal to the current time or in
     84 *  the future as it should be.
     85 */
     86POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks(
     87  const struct timespec *abstime,
     88  Watchdog_Interval     *ticks_out
     89);
     90
    5491#endif
  • cpukit/posix/src/condtimedwait.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/condtimedwait.c,v
    retrieving revision 1.3
    diff -u -r1.3 condtimedwait.c
     
    2828  const struct timespec *abstime
    2929)
    3030{
    31   Watchdog_Interval timeout;
    32   struct timespec   current_time;
    33   struct timespec   difference;
    34   boolean           already_timedout = FALSE;
    35 
    36   if ( !abstime )
    37     return EINVAL;
     31  Watchdog_Interval ticks;
     32  boolean           already_timedout;
    3833
    3934  /*
    40    *  The abstime is a walltime.  We turn it into an interval.
     35   *  POSIX requires that blocking calls with timeouts that take
     36   *  an absolute timeout must ignore issues with the absolute
     37   *  time provided if the operation would otherwise succeed.
     38   *  So we check the abstime provided, and hold on to whether it
     39   *  is valid or not.  If it isn't correct and in the future,
     40   *  then we do a polling operation and convert the UNSATISFIED
     41   *  status into the appropriate error.
    4142   */
    42 
    43   (void) clock_gettime( CLOCK_REALTIME, &current_time );
    44 
    45   /* XXX probably some error checking should go here */
    46 
    47   _POSIX_Timespec_subtract( &current_time, abstime, &difference );
    48 
    49   if ( ( difference.tv_sec < 0 ) || ( ( difference.tv_sec == 0 ) &&
    50        ( difference.tv_nsec < 0 ) ) )
    51     already_timedout = TRUE;
    52 
    53   timeout = _POSIX_Timespec_to_interval( &difference );
     43  switch ( _POSIX_Absolute_timeout_to_ticks(abstime, &ticks) ) {
     44    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     45      return EINVAL;
     46    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     47    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     48      already_timedout = TRUE;
     49      break;
     50    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     51      already_timedout = FALSE;
     52      break;
     53  }
    5454
    5555  return _POSIX_Condition_variables_Wait_support(
    5656    cond,
    5757    mutex,
    58     timeout,
     58    ticks,
    5959    already_timedout
    6060  );
    6161}
  • cpukit/posix/src/mqueuereceive.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mqueuereceive.c,v
    retrieving revision 1.5
    diff -u -r1.5 mqueuereceive.c
     
    5151    msg_ptr,
    5252    msg_len,
    5353    msg_prio,
     54    TRUE,
    5455    THREAD_QUEUE_WAIT_FOREVER
    5556  );
    5657}
  • cpukit/posix/src/mqueuerecvsupp.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mqueuerecvsupp.c,v
    retrieving revision 1.10.2.1
    diff -u -r1.10.2.1 mqueuerecvsupp.c
     
    3232#include <rtems/posix/mqueue.h>
    3333#include <rtems/posix/time.h>
    3434
    35 /*PAGE
    36  *
     35/*
    3736 *  _POSIX_Message_queue_Receive_support
    3837 *
    3938 *  NOTE: XXX Document how size, priority, length, and the buffer go
     
    4544  char               *msg_ptr,
    4645  size_t              msg_len,
    4746  unsigned int       *msg_prio,
     47  boolean             wait,
    4848  Watchdog_Interval   timeout
    4949)
    5050{
     
    5252  POSIX_Message_queue_Control_fd  *the_mq_fd;
    5353  Objects_Locations                location;
    5454  size_t                           length_out;
     55  boolean                          do_wait;
    5556
    5657  the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
    5758  switch ( location ) {
     
    8182
    8283      length_out = -1;
    8384
     85      /*
     86       *  A timed receive with a bad time will do a poll regardless.
     87       */
     88      if ( wait )
     89        do_wait = (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE;
     90      else
     91        do_wait = wait;
     92
     93      /*
     94       *  Now perform the actual message receive
     95       */
    8496      _CORE_message_queue_Seize(
    8597        &the_mq->Message_queue,
    8698        mqdes,
    8799        msg_ptr,
    88100        &length_out,
    89         (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE,
     101        do_wait,
    90102        timeout
    91103      );
    92104
  • cpukit/posix/src/mqueuesend.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mqueuesend.c,v
    retrieving revision 1.5
    diff -u -r1.5 mqueuesend.c
     
    5151    msg_ptr,
    5252    msg_len,
    5353    msg_prio,
     54    TRUE,
    5455    THREAD_QUEUE_WAIT_FOREVER
    5556  );
    5657}
  • cpukit/posix/src/mqueuesendsupp.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mqueuesendsupp.c,v
    retrieving revision 1.12.2.1
    diff -u -r1.12.2.1 mqueuesendsupp.c
     
    4343  const char         *msg_ptr,
    4444  size_t              msg_len,
    4545  uint32_t            msg_prio,
     46  boolean             wait,
    4647  Watchdog_Interval   timeout
    4748)
    4849{
     
    5051  POSIX_Message_queue_Control_fd *the_mq_fd;
    5152  Objects_Locations               location;
    5253  CORE_message_queue_Status       msg_status;
     54  boolean                         do_wait;
    5355
    5456  /*
    5557   * Validate the priority.
     
    7779
    7880      the_mq = the_mq_fd->Queue;
    7981
     82      /*
     83       *  A timed receive with a bad time will do a poll regardless.
     84       */
     85      if ( wait )
     86        do_wait = (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE;
     87      else
     88        do_wait = wait;
     89
     90      /*
     91       *  Now perform the actual message receive
     92       */
    8093      msg_status = _CORE_message_queue_Submit(
    8194        &the_mq->Message_queue,
    8295        (void *) msg_ptr,
     
    88101        NULL,
    89102#endif
    90103        _POSIX_Message_queue_Priority_to_core( msg_prio ),
    91          (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE,
     104        do_wait,
    92105        timeout    /* no timeout */
    93106      );
    94107
  • cpukit/posix/src/mqueuetimedreceive.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mqueuetimedreceive.c,v
    retrieving revision 1.6
    diff -u -r1.6 mqueuetimedreceive.c
     
    4444  char                  *msg_ptr,
    4545  size_t                 msg_len,
    4646  unsigned int          *msg_prio,
    47   const struct timespec *timeout
     47  const struct timespec *abstime
    4848)
    4949{
     50  Watchdog_Interval ticks;
     51  boolean           do_wait;
     52
     53  /*
     54   *  POSIX requires that blocking calls with timeouts that take
     55   *  an absolute timeout must ignore issues with the absolute
     56   *  time provided if the operation would otherwise succeed.
     57   *  So we check the abstime provided, and hold on to whether it
     58   *  is valid or not.  If it isn't correct and in the future,
     59   *  then we do a polling operation and convert the UNSATISFIED
     60   *  status into the appropriate error.
     61   */
     62  switch ( _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     63    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     64    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     65    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     66      do_wait = FALSE;
     67      break;
     68    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     69      do_wait = TRUE;
     70      break;
     71  }
     72
    5073  return _POSIX_Message_queue_Receive_support(
    5174    mqdes,
    5275    msg_ptr,
    5376    msg_len,
    5477    msg_prio,
    55     _POSIX_Timespec_to_interval( timeout )
     78    do_wait,
     79    ticks
    5680  );
    5781}
  • cpukit/posix/src/mqueuetimedsend.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mqueuetimedsend.c,v
    retrieving revision 1.5
    diff -u -r1.5 mqueuetimedsend.c
     
    4444  const char            *msg_ptr,
    4545  size_t                 msg_len,
    4646  unsigned int           msg_prio,
    47   const struct timespec *timeout
     47  const struct timespec *abstime
    4848)
    4949{
     50  Watchdog_Interval ticks;
     51  boolean           do_wait;
     52
     53  /*
     54   *  POSIX requires that blocking calls with timeouts that take
     55   *  an absolute timeout must ignore issues with the absolute
     56   *  time provided if the operation would otherwise succeed.
     57   *  So we check the abstime provided, and hold on to whether it
     58   *  is valid or not.  If it isn't correct and in the future,
     59   *  then we do a polling operation and convert the UNSATISFIED
     60   *  status into the appropriate error.
     61   */
     62  switch ( _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     63    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     64    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     65    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     66      do_wait = FALSE;
     67      break;
     68    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     69      do_wait = TRUE;
     70      break;
     71  }
     72
    5073  return _POSIX_Message_queue_Send_support(
    5174    mqdes,
    5275    msg_ptr,
    5376    msg_len,
    5477    msg_prio,
    55     _POSIX_Timespec_to_interval( timeout )
     78    do_wait,
     79    ticks
    5680  );
    5781}
  • cpukit/posix/src/mutexfromcorestatus.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/Attic/mutexfromcorestatus.c,v
    retrieving revision 1.2
    diff -u -r1.2 mutexfromcorestatus.c
     
    4141    case CORE_MUTEX_WAS_DELETED:
    4242      return EINVAL;
    4343    case CORE_MUTEX_TIMEOUT:
    44       return EAGAIN;
     44      return ETIMEDOUT;
    4545    case CORE_MUTEX_STATUS_CEILING_VIOLATED:
    4646      return EINVAL;
    4747    default:
  • cpukit/posix/src/mutextimedlock.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/mutextimedlock.c,v
    retrieving revision 1.3.2.1
    diff -u -r1.3.2.1 mutextimedlock.c
     
    2828
    2929int pthread_mutex_timedlock(
    3030  pthread_mutex_t       *mutex,
    31   const struct timespec *timeout
     31  const struct timespec *abstime
    3232)
    3333{
    34   return _POSIX_Mutex_Lock_support(
     34  Watchdog_Interval                            ticks;
     35  boolean                                      do_wait;
     36  POSIX_Absolute_timeout_conversion_results_t  status;
     37  int                                          lock_status;
     38
     39  /*
     40   *  POSIX requires that blocking calls with timeouts that take
     41   *  an absolute timeout must ignore issues with the absolute
     42   *  time provided if the operation would otherwise succeed.
     43   *  So we check the abstime provided, and hold on to whether it
     44   *  is valid or not.  If it isn't correct and in the future,
     45   *  then we do a polling operation and convert the UNSATISFIED
     46   *  status into the appropriate error.
     47   */
     48  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
     49  switch ( status ) {
     50    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     51    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     52    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     53      do_wait = FALSE;
     54      break;
     55    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     56      do_wait = TRUE;
     57      break;
     58  }
     59
     60  lock_status = _POSIX_Mutex_Lock_support(
    3561    mutex,
    36     TRUE,
    37     _POSIX_Timespec_to_interval( timeout )
     62    do_wait,
     63    ticks
    3864  );
     65
     66  /*
     67   *  This service only gives us the option to block.  We used a polling
     68   *  attempt to lock if the abstime was not in the future.  If we did
     69   *  not obtain the mutex, then not look at the status immediately,
     70   *  make sure the right reason is returned.
     71   */
     72  if ( !do_wait && (lock_status == EBUSY) ) {
     73    switch (lock_status) {
     74      case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     75        return EINVAL;
     76      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     77      case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     78        return ETIMEDOUT;
     79      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     80        break;
     81    }
     82  }
     83
     84  return lock_status;
    3985}
  • new file cpukit/posix/src/posixtimespecabsolutetimeout.c

    RCS file: cpukit/posix/src/posixtimespecabsolutetimeout.c
    diff -N cpukit/posix/src/posixtimespecabsolutetimeout.c
    - +  
     1/*
     2 *  Convert abstime timeout to ticks
     3 */
     4
     5/*
     6 *  COPYRIGHT (c) 1989-2007.
     7 *  On-Line Applications Research Corporation (OAR).
     8 *
     9 *  The license and distribution terms for this file may be
     10 *  found in the file LICENSE in this distribution or at
     11 *  http://www.rtems.com/license/LICENSE.
     12 *
     13 *  $Id: posixtimespecabsolutetimeout.c,v 1.2.2.1 2008/07/22 17:17:12 joel Exp $
     14 */
     15
     16#if HAVE_CONFIG_H
     17#include "config.h"
     18#endif
     19
     20#include <stdarg.h>
     21
     22#include <errno.h>
     23#include <fcntl.h>
     24#include <pthread.h>
     25#include <semaphore.h>
     26#include <limits.h>
     27
     28#include <rtems/system.h>
     29#include <rtems/score/object.h>
     30#include <rtems/posix/semaphore.h>
     31#include <rtems/posix/time.h>
     32#include <rtems/seterr.h>
     33
     34static boolean _Timespec_Is_valid(
     35  const struct timespec *time
     36)
     37{
     38  if ( !time )
     39    return FALSE;
     40
     41  if ( time->tv_sec < 0 )
     42    return FALSE;
     43
     44  if ( time->tv_nsec < 0 )
     45    return FALSE;
     46
     47  if ( time->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
     48    return FALSE;
     49
     50  return TRUE;
     51}
     52
     53static boolean _Timespec_Less_than(
     54  const struct timespec *lhs,
     55  const struct timespec *rhs
     56)
     57{
     58  if ( lhs->tv_sec < rhs->tv_sec )
     59    return TRUE;
     60
     61  if ( lhs->tv_sec > rhs->tv_sec )
     62    return FALSE;
     63
     64  /* ASSERT: lhs->tv_sec == rhs->tv_sec */
     65  if ( lhs->tv_nsec < rhs->tv_nsec )
     66    return TRUE;
     67
     68  return FALSE;
     69}
     70
     71
     72/*
     73 *  The abstime is a walltime.  We turn it into an interval.
     74 */
     75POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks(
     76  const struct timespec *abstime,
     77  Watchdog_Interval     *ticks_out
     78)
     79{
     80  struct timespec current_time;
     81  struct timespec difference;
     82
     83 
     84  /*
     85   *  Make sure there is always a value returned.
     86   */
     87  *ticks_out = 0;
     88
     89  /*
     90   *  Is the absolute time even valid?
     91   */
     92  if ( !_Timespec_Is_valid(abstime) )
     93    return POSIX_ABSOLUTE_TIMEOUT_INVALID;
     94
     95  /*
     96   *  Is the absolute time in the past?
     97   */
     98  clock_gettime( CLOCK_REALTIME, &current_time );
     99
     100  if ( _Timespec_Less_than( abstime, &current_time ) )
     101    return POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST;
     102
     103  /*
     104   *  How long until the requested absolute time?
     105   */
     106  _POSIX_Timespec_subtract( &current_time, abstime, &difference );
     107
     108  /*
     109   *  Internally the SuperCore uses ticks, so convert to them.
     110   */
     111  *ticks_out = _POSIX_Timespec_to_interval( &difference );
     112
     113  /*
     114   *  If the difference was 0, then the future is now.  It is so bright
     115   *  we better wear shades.
     116   */
     117  if ( !*ticks_out )
     118    return POSIX_ABSOLUTE_TIMEOUT_IS_NOW;
     119
     120  /*
     121   *  This is the case we were expecting and it took this long to
     122   *  get here.
     123   */
     124  return POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE;
     125}
     126
  • cpukit/posix/src/semaphorewaitsupp.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/semaphorewaitsupp.c,v
    retrieving revision 1.6.2.1
    diff -u -r1.6.2.1 semaphorewaitsupp.c
     
    2626 */
    2727
    2828int _POSIX_Semaphore_Wait_support(
    29   sem_t                          *sem,
    30   Core_semaphore_Blocking_option  blocking,
    31   Watchdog_Interval               timeout
     29  sem_t             *sem,
     30  boolean            blocking,
     31  Watchdog_Interval  timeout
    3232)
    3333{
    3434  POSIX_Semaphore_Control *the_semaphore;
     
    6565           *  count to the largest value the count can hold.
    6666           */
    6767          break;
    68         case CORE_SEMAPHORE_BAD_TIMEOUT_VALUE:
    69           rtems_set_errno_and_return_minus_one( EINVAL );
    70           break;
    7168      }
    7269  }
    7370  return 0;
  • cpukit/posix/src/semtimedwait.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/semtimedwait.c,v
    retrieving revision 1.4.2.2
    diff -u -r1.4.2.2 semtimedwait.c
     
    3232  const struct timespec *abstime
    3333)
    3434{
     35  Watchdog_Interval                            ticks;
     36  boolean                                      do_wait = TRUE;
     37  POSIX_Absolute_timeout_conversion_results_t  status;
     38  int                                          lock_status;
     39
    3540  /*
    36    *  The abstime is a walltime.  We turn it into an interval.
     41   *  POSIX requires that blocking calls with timeouts that take
     42   *  an absolute timeout must ignore issues with the absolute
     43   *  time provided if the operation would otherwise succeed.
     44   *  So we check the abstime provided, and hold on to whether it
     45   *  is valid or not.  If it isn't correct and in the future,
     46   *  then we do a polling operation and convert the UNSATISFIED
     47   *  status into the appropriate error.
    3748   */
    38   Watchdog_Interval              ticks = 0;
    39   struct timespec                current_time;
    40   struct timespec                difference;
    41   Core_semaphore_Blocking_option blocking = CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT;
     49  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
     50  switch ( status ) {
     51    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     52    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     53    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     54      do_wait = FALSE;
     55      break;
     56    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     57      do_wait = TRUE;
     58      break;
     59  }
     60
     61  lock_status = _POSIX_Semaphore_Wait_support( sem, do_wait, ticks );
    4262
    4363  /*
    44    *  Error check the absolute time to timeout
     64   *  This service only gives us the option to block.  We used a polling
     65   *  attempt to obtain if the abstime was not in the future.  If we did
     66   *  not obtain the semaphore, then not look at the status immediately,
     67   *  make sure the right reason is returned.
    4568   */
    46 #if 0
    47   if ( /* abstime->tv_sec < 0 || */ abstime->tv_nsec ) /* tv_sec is unsigned */
    48     blocking = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE;
    49   else
    50 #endif
    51   if ( abstime->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) {
    52     blocking = CORE_SEMAPHORE_BAD_TIMEOUT;
    53   } else {
    54     clock_gettime( CLOCK_REALTIME, &current_time );
    55     /*
    56      *  Make sure the abstime is in the future
    57      */
    58     if ( abstime->tv_sec < current_time.tv_sec )
    59       blocking = CORE_SEMAPHORE_BAD_TIMEOUT;
    60     else if ( (abstime->tv_sec == current_time.tv_sec) &&
    61          (abstime->tv_nsec <= current_time.tv_nsec) )
    62       blocking = CORE_SEMAPHORE_BAD_TIMEOUT;
    63     else {
    64       _POSIX_Timespec_subtract( &current_time, abstime, &difference );
    65       ticks = _POSIX_Timespec_to_interval( &difference );
    66       blocking = CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT;
     69  if ( !do_wait && (lock_status == EBUSY) ) {
     70    switch (lock_status) {
     71      case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     72        return EINVAL;
     73      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     74      case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     75        return ETIMEDOUT;
     76      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     77        break;
    6778    }
    68    }
     79  }
    6980
    70    return _POSIX_Semaphore_Wait_support( sem, blocking, ticks );
     81  return lock_status;
    7182}
  • cpukit/posix/src/semtrywait.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/semtrywait.c,v
    retrieving revision 1.3
    diff -u -r1.3 semtrywait.c
     
    3131  sem_t *sem
    3232)
    3333{
    34   return _POSIX_Semaphore_Wait_support( sem, FALSE, THREAD_QUEUE_WAIT_FOREVER );
     34  return _POSIX_Semaphore_Wait_support(sem, FALSE, THREAD_QUEUE_WAIT_FOREVER);
    3535}
  • cpukit/posix/src/semwait.c

    RCS file: /usr1/CVS/rtems/cpukit/posix/src/semwait.c,v
    retrieving revision 1.3.6.1
    diff -u -r1.3.6.1 semwait.c
     
    3131  sem_t *sem
    3232)
    3333{
    34   return _POSIX_Semaphore_Wait_support(
    35            sem,
    36            CORE_SEMAPHORE_BLOCK_FOREVER,
    37            THREAD_QUEUE_WAIT_FOREVER
    38          );
     34  return _POSIX_Semaphore_Wait_support( sem, TRUE, THREAD_QUEUE_WAIT_FOREVER );
    3935}
  • cpukit/rtems/src/semobtain.c

    RCS file: /usr1/CVS/rtems/cpukit/rtems/src/semobtain.c,v
    retrieving revision 1.9.2.1
    diff -u -r1.9.2.1 semobtain.c
     
    107107      _CORE_semaphore_Seize_isr_disable(
    108108        &the_semaphore->Core_control.semaphore,
    109109        id,
    110         ((_Options_Is_no_wait( option_set )) ?
    111           CORE_SEMAPHORE_NO_WAIT : CORE_SEMAPHORE_BLOCK_FOREVER),
     110        ((_Options_Is_no_wait( option_set )) ? FALSE : TRUE),
    112111        timeout,
    113112        &level
    114113      );
  • cpukit/rtems/src/semtranslatereturncode.c

    RCS file: /usr1/CVS/rtems/cpukit/rtems/src/semtranslatereturncode.c,v
    retrieving revision 1.11.2.1
    diff -u -r1.11.2.1 semtranslatereturncode.c
     
    103103  RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
    104104  RTEMS_TIMEOUT,            /* CORE_SEMAPHORE_TIMEOUT  */
    105105  RTEMS_INTERNAL_ERROR,     /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
    106   RTEMS_INTERNAL_ERROR      /* CORE_SEMAPHORE_BAD_TIMEOUT_VALUE */
    107106};
    108107
    109108rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
     
    114113  if ( status == THREAD_STATUS_PROXY_BLOCKING )
    115114    return RTEMS_PROXY_BLOCKING;
    116115#endif
    117   if ( status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
     116  if ( status > CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED )
    118117    return RTEMS_INTERNAL_ERROR;
    119118  return _Semaphore_Translate_core_semaphore_return_code_[status];
    120119}
  • cpukit/score/include/rtems/score/coresem.h

    RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/coresem.h,v
    retrieving revision 1.20.2.1
    diff -u -r1.20.2.1 coresem.h
     
    8282  /** This status indicates that an attempt was made to unlock the semaphore
    8383   *  and this would have made its count greater than that allowed.
    8484   */
    85   CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED,
    86   /** This status indicates that the semaphore was not immediately
    87    *  available and the caller passed a bad timeout value to the API
    88    *  routine.  In this case, the API required that the validity check
    89    *  for the timeout occur after the check that the semaphore was immediately
    90    *  available.
    91    */
    92   CORE_SEMAPHORE_BAD_TIMEOUT_VALUE
     85  CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
    9386}   CORE_semaphore_Status;
    9487
    9588/**
     
    123116}   CORE_semaphore_Control;
    124117
    125118/**
    126  *  The following enumerated type is the set of blocking options
    127  *  available to seize operation.
    128  */
    129 typedef enum {
    130   /** This value indicates that the caller does not wish to block. */
    131   CORE_SEMAPHORE_NO_WAIT,
    132   /** This value indicates that the caller is willing to block forever. */
    133   CORE_SEMAPHORE_BLOCK_FOREVER,
    134   /** This value indicates that the caller is blocking with a timeout. */
    135   CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT,
    136   /** This value indicates that the caller wanted to block but passed in
    137    *  a bad timeout value to the API. Unfortunately, this is a weird case
    138    *  where the timeout bad error is required to be generated only if
    139    *  the semaphore is not available.
    140    */
    141   CORE_SEMAPHORE_BAD_TIMEOUT
    142 } Core_semaphore_Blocking_option;
    143 
    144 /**
    145119 *  This routine initializes the semaphore based on the parameters passed.
    146120 *
    147121 *  @param[in] the_semaphore is the semaphore to initialize
     
    163137 *  @param[in] the_semaphore is the semaphore to seize
    164138 *  @param[in] id is the Id of the API level Semaphore object associated
    165139 *         with this instance of a SuperCore Semaphore
    166  *  @param[in] wait is the blocking mode
     140 *  @param[in] wait indicates if the caller is willing to block
    167141 *  @param[in] timeout is the number of ticks the calling thread is willing
    168142 *         to wait if @a wait is TRUE.
    169143 */
    170144void _CORE_semaphore_Seize(
    171   CORE_semaphore_Control         *the_semaphore,
    172   Objects_Id                      id,
    173   Core_semaphore_Blocking_option  wait,
    174   Watchdog_Interval               timeout
     145  CORE_semaphore_Control  *the_semaphore,
     146  Objects_Id               id,
     147  boolean                  wait,
     148  Watchdog_Interval        timeout
    175149);
    176150
    177151/**
  • cpukit/score/src/coremsgseize.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/coremsgseize.c,v
    retrieving revision 1.10.2.1
    diff -u -r1.10.2.1 coremsgseize.c
     
    8484
    8585    *size = the_message->Contents.size;
    8686    _Thread_Executing->Wait.count = the_message->priority;
    87     _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size);
     87    _CORE_message_queue_Copy_buffer(the_message->Contents.buffer, buffer,*size);
    8888
    8989    /*
    9090     *  There could be a thread waiting to send a message.  If there
     
    107107     */
    108108
    109109    the_message->priority  = the_thread->Wait.count;
    110     the_message->Contents.size = (uint32_t  )the_thread->Wait.return_argument_1;
     110    the_message->Contents.size = (uint32_t)the_thread->Wait.option;
    111111    _CORE_message_queue_Copy_buffer(
    112112      the_thread->Wait.return_argument,
    113113      the_message->Contents.buffer,
  • cpukit/score/src/coresemseize.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/coresemseize.c,v
    retrieving revision 1.4.2.2
    diff -u -r1.4.2.2 coresemseize.c
     
    5151 */
    5252
    5353void _CORE_semaphore_Seize(
    54   CORE_semaphore_Control         *the_semaphore,
    55   Objects_Id                      id,
    56   Core_semaphore_Blocking_option  wait,
    57   Watchdog_Interval               timeout
     54  CORE_semaphore_Control *the_semaphore,
     55  Objects_Id              id,
     56  boolean                 wait,
     57  Watchdog_Interval       timeout
    5858)
    5959{
    6060  Thread_Control *executing;
     
    6969    return;
    7070  }
    7171
    72   switch ( wait ) {
    73     case CORE_SEMAPHORE_NO_WAIT:
    74       _ISR_Enable( level );
    75       executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
    76       return;
    77     case CORE_SEMAPHORE_BAD_TIMEOUT:
    78       _ISR_Enable( level );
    79       executing->Wait.return_code = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE;
    80       return;
    81     case CORE_SEMAPHORE_BLOCK_FOREVER:
    82     case CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT:
    83       _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
    84       executing->Wait.queue          = &the_semaphore->Wait_queue;
    85       executing->Wait.id             = id;
    86       _ISR_Enable( level );
    87       _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
    88       break;
     72  if ( !wait ) {
     73    _ISR_Enable( level );
     74    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
     75    return;
    8976  }
    9077
     78   /*
     79    *  If the semaphore is not available and the caller is willing to
     80    *  block, then we now block the caller with optional timeout.
     81    */
     82  _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
     83  executing->Wait.queue = &the_semaphore->Wait_queue;
     84  executing->Wait.id    = id;
     85  _ISR_Enable( level );
     86  _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
     87
    9188}
  • doc/posix_users/mutex.t

    RCS file: /usr1/CVS/rtems/doc/posix_users/mutex.t,v
    retrieving revision 1.6
    diff -u -r1.6 mutex.t
     
    630630@item EDEADLK
    631631The current thread already owns the mutex.
    632632
     633@item ETIMEDOUT
     634The calling thread was unable to obtain the mutex within the specified
     635timeout period.
     636
    633637@end table
    634638
    635639@subheading DESCRIPTION:
  • doc/posix_users/semaphores.t

    RCS file: /usr1/CVS/rtems/doc/posix_users/semaphores.t,v
    retrieving revision 1.8
    diff -u -r1.8 semaphores.t
     
    463463@example
    464464int sem_timedwait(
    465465  sem_t                 *sem,
    466   const struct timespec *timeout
     466  const struct timespec *abstime
    467467);
    468468@end example
    469469@end ifset
     
    484484@end table
    485485
    486486@subheading DESCRIPTION:
    487 This function attemtps to lock a semaphore specified by @code{sem}, and will
    488 wait for the semaphore for an interval specified by @code{timeout}. If the
    489 semaphore is available, then the semaphore is locked (i.e., the semaphore
    490 value is decremented) and the function returns a value of 0. The semaphore
    491 remains locked until released by a @code{sem_post()} call. If the semaphore
    492 is unavailable, then the function will wait for the semaphore to become
    493 available for the amount of time specified by @code{timeout}.
     487
     488This function attemtps to lock a semaphore specified by @code{sem},
     489and will wait for the semaphore until the absolute time specified by
     490@code{abstime}. If the semaphore is available, then the semaphore is
     491locked (i.e., the semaphore value is decremented) and the function
     492returns a value of 0. The semaphore remains locked until released by
     493a @code{sem_post()} call. If the semaphore is unavailable, then the
     494function will wait for the semaphore to become available for the amount
     495of time specified by @code{timeout}.
    494496
    495497If the semaphore does not become available within the interval specified by
    496498@code{timeout}, then the function returns -1 and sets @code{errno} to EAGAIN.
  • testsuites/psxtests/psx05/init.c

    RCS file: /usr1/CVS/rtems/testsuites/psxtests/psx05/init.c,v
    retrieving revision 1.21
    diff -u -r1.21 init.c
     
    7272  }
    7373}
    7474
     75void calculate_abstimeout(
     76  struct timespec *times,
     77  uint32_t         seconds,
     78  uint32_t         nanoseconds
     79)
     80{
     81  struct timeval       tv1;
     82  struct timezone      tz1;
     83
     84  gettimeofday( &tv1, &tz1 );
     85
     86  times->tv_sec  = seconds     + tv1.tv_sec;
     87  times->tv_nsec = nanoseconds + (tv1.tv_usec * 1000);
     88
     89  while ( times->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) {
     90    times->tv_sec++;
     91    times->tv_nsec - TOD_NANOSECONDS_PER_SECOND;
     92  }
     93
     94}
     95
    7596void *POSIX_Init(
    7697  void *argument
    7798)
     
    343364    printf( "status = %d\n", status );
    344365  assert( status == EPERM );
    345366
    346   times.tv_sec = 0;
    347   times.tv_nsec = 500000000;
    348367  puts( "Init: pthread_mutex_timedlock - time out in 1/2 second" );
     368  calculate_abstimeout( &times, 0, (TOD_NANOSECONDS_PER_SECOND / 2) );
     369
    349370  status = pthread_mutex_timedlock( &Mutex_id, &times );
    350   if ( status != EAGAIN )
     371  if ( status != ETIMEDOUT )
    351372    printf( "status = %d\n", status );
    352   assert( status == EAGAIN );
     373  assert( status == ETIMEDOUT );
    353374
    354375     /* switch to idle */
    355376
  • testsuites/psxtests/psxmsgq01/init.c

    RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxmsgq01/init.c,v
    retrieving revision 1.15
    diff -u -r1.15 init.c
     
    750750  int              status;
    751751  char            *msg;
    752752
    753   timeout.tv_sec  = 1;
    754   timeout.tv_nsec = 0;
    755 
    756753  printf( "Init: mq_timedsend - on queue %s ", Test_q[que].name);
    757754  len = Predefined_Msgs[MAXMSG].size;
    758755  msg = Predefined_Msgs[MAXMSG].msg;
     756
    759757  gettimeofday( &tv1, &tz1 );
     758  timeout.tv_sec  = tv1.tv_sec + 1;
     759  timeout.tv_nsec = tv1.tv_usec * 1000;
     760
    760761  status = mq_timedsend( Test_q[que].mq, msg, len , 0, &timeout );
     762
    761763  gettimeofday( &tv2, &tz2 );
    762764  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
    763765  tv3.tv_usec = tv2.tv_usec - tv1.tv_usec;
    764766
    765767  if ( is_blocking ) { /* Don't verify the non-blocking queue */
    766     fatal_int_service_status( status, -1, "mq_timedsend status");
    767     fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT");
     768    fatal_int_service_status( status, -1, "mq_timedsend status" );
     769    fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT" );
    768770  }
    769771
    770   printf("Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    771 
    772   if ( is_blocking ) /* non-blocking queue */
    773     assert( tv3.tv_sec == 1 );
    774   else
    775     assert( tv3.tv_sec == 0 );
     772  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    776773
    777774  if ( que == DEFAULT_RW )
    778775    Test_q[que].count++;
     
    805802  struct timezone tz1, tz2;
    806803  int              status;
    807804
    808   tm.tv_sec  = 1;
    809   tm.tv_nsec = 0;
    810 
    811   printf( "Init: %s mq_timedreceive - on queue %s ", task_name, Test_q[que].name);
     805  printf(
     806    "Init: %s mq_timedreceive - on queue %s ",
     807    task_name,
     808    Test_q[que].name
     809  );
    812810
    813811  gettimeofday( &tv1, &tz1 );
     812  tm.tv_sec  = tv1.tv_sec + 1;
     813  tm.tv_nsec = tv1.tv_usec * 1000;
     814
    814815  status = mq_timedreceive( Test_q[ que ].mq, message, 100, &priority, &tm );
     816
    815817  gettimeofday( &tv2, &tz2 );
    816818  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
    817819  tv3.tv_usec = tv2.tv_usec - tv1.tv_usec;
     
    821823    fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT");
    822824  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    823825
    824   if ( is_blocking )
    825     assert( tv3.tv_sec == 1 );
    826   else
    827     assert( tv3.tv_sec == 0 );
    828826}
    829827
    830 
    831 
    832828void verify_timed_receive()
    833829{
    834830  int  que;
  • testsuites/psxtests/psxmsgq01/system.h

    RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxmsgq01/system.h,v
    retrieving revision 1.9
    diff -u -r1.9 system.h
     
    4444#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    4545#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
    4646        (RTEMS_MINIMUM_STACK_SIZE * 10)
     47#define STACK_CHECKER_ON
    4748
    4849#include <rtems/confdefs.h>
    4950
  • testsuites/psxtests/psxsem01/init.c

    RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxsem01/init.c,v
    retrieving revision 1.8.2.2
    diff -u -r1.8.2.2 init.c
     
    114114  fatal_posix_service_status( status, -1, "sem_timedwait error return status");
    115115  fatal_posix_service_status( errno, ETIMEDOUT, "sem_timedwait errno ETIMEDOUT");
    116116
    117   puts( "Init: sem_timedwait - UNSUCCESSFUL (EINVAL)" );
     117  puts( "Init: sem_timedwait - UNSUCCESSFUL (EAGAIN)" );
    118118  waittime.tv_sec = 0;
    119119  waittime.tv_nsec = 0x7FFFFFFF;
    120120  status = sem_timedwait(&sems[2], &waittime);
    121121  fatal_posix_service_status( status, -1, "sem_timedwait error return status");
    122   fatal_posix_service_status( errno, EINVAL, "sem_init errno EINVAL");
     122  fatal_posix_service_status( errno, EAGAIN, "sem_init errno EAGAIN");
    123123
    124124  puts( "Init: sem_post - UNSUCCESSFUL (EINVAL)" );
    125125  status = sem_post(&sem2);
  • testsuites/psxtests/psxsem01/psxsem01.scn

    RCS file: /usr1/CVS/rtems/testsuites/psxtests/psxsem01/psxsem01.scn,v
    retrieving revision 1.2
    diff -u -r1.2 psxsem01.scn
     
    1515Init: sem_trywait - UNSUCCESSFUL (EINVAL)
    1616Init: sem_timedwait - SUCCESSFUL
    1717Init: sem_timedwait - UNSUCCESSFUL (ETIMEDOUT)
    18 Init: sem_timedwait - UNSUCCESSFUL (EINVAL)
     18Init: sem_timedwait - UNSUCCESSFUL (EAGAIN)
    1919Init: sem_post - UNSUCCESSFUL (EINVAL)
    2020Init: sem_destroy - SUCCESSFUL
    2121Init: sem_open - sem1 SUCCESSFUL