Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:12

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSImplApplConfig
0007  *
0008  * @brief This header file evaluates configuration options related to
0009  *   the FACE Technical Standard.
0010  *
0011  * The FACE Technical Standard (https://opengroup.org/face) is an
0012  * open standard designed for safety critical embedded systems. It
0013  * includes POSIX profiles and requirements that promote safety
0014  * and portability. As a general rules, the profiles place a minimum
0015  * on the services which an operating system must provide. Those
0016  * same profile definitions represent the maximum services which
0017  * an application may use. 
0018  */
0019 
0020 /*
0021  * Copyright (C) 2022 On-Line Applications Research Corporation (OAR)
0022  *
0023  * Redistribution and use in source and binary forms, with or without
0024  * modification, are permitted provided that the following conditions
0025  * are met:
0026  * 1. Redistributions of source code must retain the above copyright
0027  *    notice, this list of conditions and the following disclaimer.
0028  * 2. Redistributions in binary form must reproduce the above copyright
0029  *    notice, this list of conditions and the following disclaimer in the
0030  *    documentation and/or other materials provided with the distribution.
0031  *
0032  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0033  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0034  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0035  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0036  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0037  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0038  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0039  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0040  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0041  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0042  * POSSIBILITY OF SUCH DAMAGE.
0043  */
0044 
0045 #ifndef _RTEMS_CONFDEFS_FACE_H
0046 #define _RTEMS_CONFDEFS_FACE_H
0047 
0048 #ifndef __CONFIGURATION_TEMPLATE_h
0049 #error "Do not include this file directly, use <rtems/confdefs.h> instead"
0050 #endif
0051 
0052 #ifdef CONFIGURE_INIT
0053 
0054 #ifdef CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
0055 
0056   #include <rtems/posix/timer.h>
0057 
0058   int _POSIX_Timer_Is_allowed(
0059     clockid_t clock_id
0060   )
0061   {
0062     /*
0063      * Per the FACE Technical Standard, POSIX timers should not be
0064      * allowed on CLOCK_REALTIME for safety reasons. If the application
0065      * wants the FACE behavior, then this method is instantiated.
0066      */
0067     if (  clock_id == CLOCK_REALTIME ) {
0068       return EPERM;
0069     }
0070 
0071     if ( clock_id != CLOCK_MONOTONIC ) {
0072       return EINVAL;
0073     }
0074 
0075     return 0;
0076   }
0077 
0078 #endif /* CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR */
0079 
0080 #endif /* CONFIGURE_INIT */
0081 
0082 #endif /* _RTEMS_CONFDEFS_FACE_H */