Changeset b5c9064 in rtems for cpukit/sapi


Ignore:
Timestamp:
Aug 5, 2013, 1:20:45 PM (6 years ago)
Author:
Zhongwei Yao <ashi08104@…>
Branches:
4.11, master
Children:
03a5a8a
Parents:
5a556e4e
git-author:
Zhongwei Yao <ashi08104@…> (08/05/13 13:20:45)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/06/13 12:11:38)
Message:

Unlimited objects support for POSIX keys

This patch enables unlimited model in POSIX key manger and have a decent
runtime on POSIX key searching, adding and deleting operations. Memory
overhead is lower than current implementation when the size of key and key
value becomes big.

File:
1 edited

Legend:

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

    r5a556e4e rb5c9064  
    17291729  #ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
    17301730    #define CONFIGURE_MAXIMUM_POSIX_KEYS           0
    1731     #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) 0
    1732   #else
    1733     #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) \
     1731    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS      0
     1732    #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _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  #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs)       \
    17341740      (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
    1735         + (_keys) * 3 * _Configure_From_workspace(sizeof(void *) * 2))
     1741  + _Configure_From_workspace(_key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
    17361742  #endif
    17371743
     
    18551861          CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES + \
    18561862          CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES) + \
    1857       CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ) + \
     1863      CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS, \
     1864                                       CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
    18581865      CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
    18591866          CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ) + \
     
    23042311        CONFIGURE_GO_INIT_CONDITION_VARIABLES + CONFIGURE_MAXIMUM_GO_CHANNELS,
    23052312      CONFIGURE_MAXIMUM_POSIX_KEYS,
     2313      CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS,
    23062314      CONFIGURE_MAXIMUM_POSIX_TIMERS,
    23072315      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
     
    25462554      CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
    25472555      CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_CONDITION_VARIABLES),
    2548     CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS ),
     2556    CONFIGURE_MEMORY_FOR_POSIX_KEYS( CONFIGURE_MAXIMUM_POSIX_KEYS, \
     2557                                     CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ),
    25492558    CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
    25502559      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
     
    26172626       (CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES != 0) || \
    26182627       (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) || \
     2628       (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0) || \
    26192629       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
    26202630       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
     
    26982708#endif
    26992709
     2710/*
     2711 * POSIX Key pair shouldn't be less than POSIX Key, which is highly
     2712 * likely to be error.
     2713 */
     2714#if defined(RTEMS_POSIX_API)
     2715    #if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \
     2716      (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0)
     2717      #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < \
     2718        CONFIGURE_MAXIMUM_POSIX_KEYS)
     2719      #error "Fewer POSIX Key pairs than POSIX Key!"
     2720      #endif
     2721    #endif
     2722#endif
     2723
    27002724#endif
    27012725/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.