Changeset 4b04589b in rtems


Ignore:
Timestamp:
08/01/22 22:12:21 (4 months ago)
Author:
Joel Sherrill <joel@…>
Branches:
master
Children:
b6e00691
Parents:
cf3d2b37
git-author:
Joel Sherrill <joel@…> (08/01/22 22:12:21)
git-committer:
Joel Sherrill <joel@…> (08/10/22 19:15:46)
Message:

Add support for CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR

This adds the configure option CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
which allows the application to choose whether to have the POSIX
timer_create() function follow the behavior defined by POSIX or
the FACE Technical Standard.

Updates #4691.

Files:
5 added
4 edited

Legend:

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

    rcf3d2b37 r4b04589b  
    6565#include <rtems/confdefs/console.h>
    6666#include <rtems/confdefs/extensions.h>
     67#include <rtems/confdefs/face.h>
    6768#include <rtems/confdefs/inittask.h>
    6869#include <rtems/confdefs/initthread.h>
  • cpukit/include/rtems/posix/timer.h

    rcf3d2b37 r4b04589b  
    9595  )
    9696
     97/**
     98 * @brief Follow POSIX or FACE Technical Standard on timer_create
     99 *
     100 * POSIX allows for the creation of timers based on CLOCK_REALTIME.
     101 * This is viewed as a safety issue by the FACE Technical Standard
     102 * and required to return an error. These are conflicting behaviors.
     103 * This method is instanced by configuration when FACE conformant
     104 * behavior is desired by the application.
     105 *
     106 * @param[in] clock_id is the clock ID to validate
     107 *
     108 * @return 0 if @a clock_id is allowed for use. Otherwise an errno value.
     109 */
     110int _POSIX_Timer_Is_allowed(
     111  clockid_t clock_id
     112);
     113
     114
    97115/** @} */
    98116
  • cpukit/posix/src/psxtimercreate.c

    rcf3d2b37 r4b04589b  
    5252#include <rtems/sysinit.h>
    5353
     54RTEMS_WEAK int _POSIX_Timer_Is_allowed(
     55  clockid_t clock_id
     56)
     57{
     58  int rc = 0;
     59
     60  /*
     61   * Allow timer_create(CLOCK_REALTIME. ...) per POSIX by default
     62   * on CLOCK_REALTIME or CLOCK_MONOTONIC.
     63   *
     64   * But per the FACE Technical Standard, POSIX timers should not be
     65   * allowed on CLOCK_REALTIME for safety reasons. If the application
     66   * configures that it wants the FACE behavior, then this method
     67   * is overridden by <rtems/confdefs/timer.h>.
     68   */
     69
     70  if (  clock_id != CLOCK_REALTIME ) {
     71    if ( clock_id != CLOCK_MONOTONIC ) {
     72      rc  = EINVAL;
     73    }
     74  }
     75
     76  return rc;
     77}
     78
    5479int timer_create(
    5580  clockid_t        clock_id,
     
    5984{
    6085  POSIX_Timer_Control *ptimer;
     86  int                  rc;
    6187
    62   if (  clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
    63     rtems_set_errno_and_return_minus_one( EINVAL );
     88  rc = _POSIX_Timer_Is_allowed( clock_id );
     89  if ( rc != 0 )
     90    rtems_set_errno_and_return_minus_one( rc );
    6491
    6592  if ( !timerid )
  • spec/build/testsuites/psxtests/grp.yml

    rcf3d2b37 r4b04589b  
    241241  uid: psxtimer02
    242242- role: build-dependency
     243  uid: psxtimer_face01
     244- role: build-dependency
    243245  uid: psxtimes01
    244246- role: build-dependency
Note: See TracChangeset for help on using the changeset viewer.