Changeset e6c87f7 in rtems for cpukit/sapi


Ignore:
Timestamp:
Mar 4, 2014, 9:54:12 PM (6 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
f4accfd
Parents:
5c332349
git-author:
Joel Sherrill <joel.sherrill@…> (03/04/14 21:54:12)
git-committer:
Joel Sherrill <joel.sherrill@…> (03/07/14 19:21:11)
Message:

POSIX keys now enabled in all configurations.

Formerly POSIX keys were only enabled when POSIX threads
were enabled. Because they are a truly safe alternative
to per-task variables in an SMP system, they are being
enabled in all configurations.

Location:
cpukit/sapi
Files:
4 edited

Legend:

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

    r5c332349 re6c87f7  
    3030
    3131/*
    32  *  COPYRIGHT (c) 1989-2011.
     32 *  COPYRIGHT (c) 1989-2014.
    3333 *  On-Line Applications Research Corporation (OAR).
    3434 *
     
    17231723 */
    17241724
     1725/*
     1726 *  POSIX Keys are available whether or not the POSIX API is enabled.
     1727 */
     1728#include <rtems/posix/key.h>
     1729
     1730#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
     1731  #define CONFIGURE_MAXIMUM_POSIX_KEYS            0
     1732  #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 0
     1733#else
     1734  #ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
     1735    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
     1736      (CONFIGURE_MAXIMUM_POSIX_KEYS * \
     1737       (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
     1738  #endif
     1739#endif
     1740
     1741#define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
     1742   (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
     1743    + _Configure_From_workspace( \
     1744        _key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
     1745
     1746/*
     1747 *  The rest of the POSIX threads API features are only available when
     1748 *  POSIX is enabled.
     1749 */
     1750
    17251751#ifdef RTEMS_POSIX_API
    1726 
    17271752  #include <sys/types.h>
    17281753  #include <signal.h>
     
    17331758  #include <rtems/posix/mqueue.h>
    17341759  #include <rtems/posix/mutex.h>
    1735   #include <rtems/posix/key.h>
    17361760  #include <rtems/posix/psignal.h>
    17371761  #include <rtems/posix/pthread.h>
     
    17751799                          sizeof(POSIX_Condition_variables_Control) )
    17761800
    1777   #ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
    1778     #define CONFIGURE_MAXIMUM_POSIX_KEYS            0
    1779     #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 0
    1780   #else
    1781     #ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
    1782       #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
    1783         CONFIGURE_MAXIMUM_POSIX_KEYS \
    1784         * (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS)
    1785     #endif
    1786   #endif
    1787   #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
    1788      (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
    1789       + _Configure_From_workspace(_key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
    1790 
    17911801  #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
    17921802    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
     
    18951905          CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES + \
    18961906          CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES) + \
    1897       CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS, \
    1898                                        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
    18991907      CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
    19001908          CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ) + \
     
    22142222     CONFIGURE_TOTAL_TASKS_AND_THREADS, CONFIGURE_TOTAL_TASKS_AND_THREADS) + \
    22152223   CONFIGURE_MEMORY_FOR_CLASSIC + \
     2224   CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
     2225      CONFIGURE_MAXIMUM_POSIX_KEYS, \
     2226      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
    22162227   CONFIGURE_MEMORY_FOR_POSIX + \
    22172228   CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
     
    23452356        CONFIGURE_MAXIMUM_ADA_TASKS + CONFIGURE_MAXIMUM_FAKE_ADA_TASKS +
    23462357        CONFIGURE_GO_INIT_CONDITION_VARIABLES + CONFIGURE_MAXIMUM_GO_CHANNELS,
    2347       CONFIGURE_MAXIMUM_POSIX_KEYS,
    2348       CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,
    23492358      CONFIGURE_MAXIMUM_POSIX_TIMERS,
    23502359      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
     
    23902399    CONFIGURE_STACK_SPACE_SIZE,               /* required stack space */
    23912400    CONFIGURE_MAXIMUM_USER_EXTENSIONS,        /* maximum dynamic extensions */
     2401    CONFIGURE_MAXIMUM_POSIX_KEYS,             /* POSIX keys are always */
     2402    CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,  /*   enabled */
    23922403    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
    23932404    1000 * CONFIGURE_MICROSECONDS_PER_TICK,   /* nanoseconds per clock tick */
     
    25262537    uint32_t USER_EXTENSIONS;
    25272538
     2539    /* POSIX API managers that are always enabled */
     2540    uint32_t POSIX_KEYS;
     2541
    25282542#ifdef RTEMS_POSIX_API
    25292543    /* POSIX API Pieces */
    25302544    uint32_t POSIX_MUTEXES;
    25312545    uint32_t POSIX_CONDITION_VARIABLES;
    2532     uint32_t POSIX_KEYS;
    25332546    uint32_t POSIX_TIMERS;
    25342547    uint32_t POSIX_QUEUED_SIGNALS;
     
    25812594    CONFIGURE_MEMORY_FOR_BARRIERS(CONFIGURE_BARRIERS),
    25822595    CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS),
     2596    CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS, \
     2597                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
    25832598
    25842599#ifdef RTEMS_POSIX_API
     
    25902605      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
    25912606      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES),
    2592     CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS, \
    2593                                      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
    25942607    CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
    25952608      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
     
    26562669 *  If an attempt was made to configure POSIX objects and
    26572670 *  the POSIX API was not configured into RTEMS, error out.
     2671 *
     2672 *  @note POSIX Keys are always available so the parameters
     2673 *        CONFIGURE_MAXIMUM_POSIX_KEYS and
     2674 *        CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS  are not in this list.
    26582675 */
    26592676#if !defined(RTEMS_POSIX_API)
     
    26612678       (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
    26622679       (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
    2663        (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) || \
    2664        (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0) || \
    26652680       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
    26662681       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
     
    27482763 * likely to be error.
    27492764 */
    2750 #if defined(RTEMS_POSIX_API)
    2751     #if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
    2752       (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
    2753       #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < \
    2754         CONFIGURE_MAXIMUM_POSIX_KEYS)
    2755       #error "Fewer POSIX Key pairs than POSIX Key!"
    2756       #endif
    2757     #endif
     2765#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
     2766    (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
     2767  #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS)
     2768    #error "Fewer POSIX Key pairs than POSIX Key!"
     2769  #endif
    27582770#endif
    27592771
  • cpukit/sapi/include/rtems/config.h

    r5c332349 re6c87f7  
    99
    1010/*
    11  *  COPYRIGHT (c) 1989-2011.
     11 *  COPYRIGHT (c) 1989-2014.
    1212 *  On-Line Applications Research Corporation (OAR).
    1313 *
     
    143143   */
    144144  uint32_t                       maximum_extensions;
     145
     146  /**
     147   * This field contains the maximum number of POSIX API
     148   * keys which are configured for this application.
     149   */
     150  uint32_t                       maximum_keys;
     151
     152  /**
     153   * This field contains the maximum number of POSIX API
     154   * key value pairs which are configured for this application.
     155   *
     156   * @note There can be potentially be a key/value pair for
     157   *       every thread to use every key. But normally this
     158   *       many are not needed in a system.
     159   */
     160  uint32_t                            maximum_key_value_pairs;
    145161
    146162  /**
  • cpukit/sapi/src/exinit.c

    r5c332349 re6c87f7  
    22 * @file
    33 *
    4  * @brief Device Driver Initialization Functions
     4 * @brief Initialization Manager
    55 *
    66 * @ingroup ClassicRTEMS
     
    88
    99/*
    10  *  Initialization Manager
    11  *
    12  *  COPYRIGHT (c) 1989-2011.
     10 *  COPYRIGHT (c) 1989-2014.
    1311 *  On-Line Applications Research Corporation (OAR).
    1412 *
     
    5856
    5957#include <rtems/rtems/rtemsapi.h>
    60 #ifdef RTEMS_POSIX_API
    61   #include <rtems/posix/posixapi.h>
    62 #endif
     58#include <rtems/posix/posixapi.h>
    6359
    6460Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
     
    148144  _IO_Manager_initialization();
    149145
    150   #ifdef RTEMS_POSIX_API
    151     _POSIX_API_Initialize();
    152   #endif
     146  _POSIX_API_Initialize();
    153147
    154148  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
  • cpukit/sapi/src/posixapi.c

    r5c332349 re6c87f7  
    88
    99/*
    10  *  COPYRIGHT (c) 1989-2010.
     10 *  COPYRIGHT (c) 1989-2014.
    1111 *  On-Line Applications Research Corporation (OAR).
    1212 *
     
    2323
    2424#include <rtems/system.h>    /* include this before checking RTEMS_POSIX_API */
     25
     26#include <rtems/config.h>
     27#include <rtems/posix/keyimpl.h>
     28#include <rtems/posix/posixapi.h>
     29
    2530#ifdef RTEMS_POSIX_API
    26 
    2731#include <sys/types.h>
    2832#include <mqueue.h>
    2933#include <rtems/config.h>
    3034#include <rtems/posix/barrierimpl.h>
     35#include <rtems/posix/config.h>
    3136#include <rtems/posix/condimpl.h>
    32 #include <rtems/posix/config.h>
    33 #include <rtems/posix/keyimpl.h>
    3437#include <rtems/posix/mqueueimpl.h>
    3538#include <rtems/posix/muteximpl.h>
    3639#include <rtems/posix/onceimpl.h>
    37 #include <rtems/posix/posixapi.h>
    3840#include <rtems/posix/priorityimpl.h>
    3941#include <rtems/posix/psignalimpl.h>
     
    4446#include <rtems/posix/spinlockimpl.h>
    4547#include <rtems/posix/time.h>
     48#endif
    4649
    4750void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno )
     
    6972  _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects;
    7073
    71   _POSIX_signals_Manager_Initialization();
    72   _POSIX_Threads_Manager_initialization();
    73   _POSIX_Condition_variables_Manager_initialization();
    7474  _POSIX_Key_Manager_initialization();
    75   _POSIX_Mutex_Manager_initialization();
    76   _POSIX_Message_queue_Manager_initialization();
    77   _POSIX_Once_Manager_initialization();
    78   _POSIX_Semaphore_Manager_initialization();
    79   _POSIX_Timer_Manager_initialization();
    80   _POSIX_Barrier_Manager_initialization();
    81   _POSIX_RWLock_Manager_initialization();
    82   _POSIX_Spinlock_Manager_initialization();
     75
     76  #ifdef RTEMS_POSIX_API
     77    _POSIX_signals_Manager_Initialization();
     78    _POSIX_Threads_Manager_initialization();
     79    _POSIX_Condition_variables_Manager_initialization();
     80    _POSIX_Mutex_Manager_initialization();
     81    _POSIX_Message_queue_Manager_initialization();
     82    _POSIX_Once_Manager_initialization();
     83    _POSIX_Semaphore_Manager_initialization();
     84    _POSIX_Timer_Manager_initialization();
     85    _POSIX_Barrier_Manager_initialization();
     86    _POSIX_RWLock_Manager_initialization();
     87    _POSIX_Spinlock_Manager_initialization();
     88  #endif
    8389}
    84 
    85 #endif
Note: See TracChangeset for help on using the changeset viewer.