source: rtems/cpukit/include/rtems/posix/key.h

Last change on this file was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 22, 2018 at 6:14:51 PM

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Key Private Support
5 *
6 * This include file contains all the private support information for
7 * POSIX key.
8 */
9
10/*
11 * Copyright (c) 2012 Zhongwei Yao.
12 * COPYRIGHT (c) 1989-2011.
13 * On-Line Applications Research Corporation (OAR).
14 * Copyright (c) 2016 embedded brains GmbH.
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_POSIX_KEY_H
22#define _RTEMS_POSIX_KEY_H
23
24#include <pthread.h>
25
26#include <rtems/score/chain.h>
27#include <rtems/score/object.h>
28#include <rtems/score/rbtree.h>
29#include <rtems/score/thread.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/**
36 * @defgroup POSIX_KEY POSIX Key
37 *
38 * @ingroup POSIXAPI
39 *
40 */
41/**@{**/
42
43/**
44 * @brief Represents POSIX key and value pair.
45 */
46typedef struct {
47  /**
48   * @brief The chain node for the key value pairs chain in POSIX_Keys_Control.
49   */
50  Chain_Node Key_node;
51
52  /**
53   * @brief The tree node for the lookup tree in Thread_Keys_information.
54   */
55  RBTree_Node Lookup_node;
56
57  /**
58   * @brief The POSIX key identifier used as the tree key.
59   */
60  pthread_key_t key;
61
62  /**
63   * @brief The corresponding thread.
64   */
65  Thread_Control *thread;
66
67  /**
68   * @brief The thread specific POSIX key value.
69   */
70  void *value;
71} POSIX_Keys_Key_value_pair;
72
73/**
74 * @brief The initial set of POSIX key and value pairs.
75 *
76 * This array is provided via <rtems/confdefs.h> in case POSIX key and value
77 * pairs are configured.  The POSIX key and value pair count in this array must
78 * be equal to
79 * _Objects_Maximum_per_allocation( _POSIX_Keys_Key_value_pair_maximum ).
80 */
81extern POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[];
82
83/**
84 * @brief The POSIX key and value pairs maximum.
85 *
86 * This value is provided via <rtems/confdefs.h> in case POSIX key and value
87 * pairs are configured.  The OBJECTS_UNLIMITED_OBJECTS flag may be set.
88 */
89extern const uint32_t _POSIX_Keys_Key_value_pair_maximum;
90
91/**
92 * @brief The data structure used to manage a POSIX key.
93 */
94typedef struct {
95   /** This field is the Object control structure. */
96   Objects_Control     Object;
97   /** This field is the data destructor. */
98   void (*destructor) (void *);
99
100   /**
101    * @brief Key value pairs of this key.
102    */
103   Chain_Control Key_value_pairs;
104 }  POSIX_Keys_Control;
105
106/**
107 * @brief The POSIX Key objects information.
108 */
109extern Objects_Information _POSIX_Keys_Information;
110
111/**
112 * @brief Macro to define the objects information for the POSIX Key objects.
113 *
114 * This macro should only be used by <rtems/confdefs.h>.
115 *
116 * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
117 * may be set).
118 */
119#define POSIX_KEYS_INFORMATION_DEFINE( max ) \
120  OBJECTS_INFORMATION_DEFINE( \
121    _POSIX_Keys, \
122    OBJECTS_POSIX_API, \
123    OBJECTS_POSIX_KEYS, \
124    POSIX_Keys_Control, \
125    max, \
126    OBJECTS_NO_STRING_NAME, \
127    NULL \
128  )
129
130/** @} */
131
132#ifdef __cplusplus
133}
134#endif
135
136#endif
137/*  end of include file */
Note: See TracBrowser for help on using the repository browser.