source: rtems/cpukit/include/rtems/posix/keyimpl.h @ 0f5b2c09

5
Last change on this file since 0f5b2c09 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 4.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Private Inlined Routines for POSIX Key's
5 *
6 * This include file contains the static inline implementation of the private
7 * inlined routines for POSIX key's.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *  Copyright (c) 2016 embedded brains GmbH.
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#include <rtems/posix/key.h>
21#include <rtems/score/chainimpl.h>
22#include <rtems/score/freechain.h>
23#include <rtems/score/objectimpl.h>
24#include <rtems/score/percpu.h>
25
26#ifndef _RTEMS_POSIX_KEYIMPL_H
27#define _RTEMS_POSIX_KEYIMPL_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/**
34 * @addtogroup POSIX_KEY
35 *
36 * @{
37 */
38
39/**
40 * @brief The information control block used to manage this class of objects.
41 */
42extern Objects_Information _POSIX_Keys_Information;
43
44/**
45 * @brief This freechain is used as a memory pool for POSIX_Keys_Key_value_pair.
46 */
47extern Freechain_Control _POSIX_Keys_Keypool;
48
49#define POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( node ) \
50  RTEMS_CONTAINER_OF( node, POSIX_Keys_Key_value_pair, Lookup_node )
51
52/**
53 * @brief Allocate a keys control block.
54 *
55 * This function allocates a keys control block from
56 * the inactive chain of free keys control blocks.
57 */
58
59RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
60{
61  return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
62}
63
64/**
65 * @brief Free a keys control block.
66 *
67 * This routine frees a keys control block to the
68 * inactive chain of free keys control blocks.
69 */
70RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free(
71  POSIX_Keys_Control *the_key
72)
73{
74  _Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
75}
76
77RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get( pthread_key_t key )
78{
79  return (POSIX_Keys_Control *)
80    _Objects_Get_no_protection( (Objects_Id) key, &_POSIX_Keys_Information );
81}
82
83RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_acquire(
84  Thread_Control   *the_thread,
85  ISR_lock_Context *lock_context
86)
87{
88  _ISR_lock_ISR_disable_and_acquire( &the_thread->Keys.Lock, lock_context );
89}
90
91RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_release(
92  Thread_Control   *the_thread,
93  ISR_lock_Context *lock_context
94)
95{
96  _ISR_lock_Release_and_ISR_enable( &the_thread->Keys.Lock, lock_context );
97}
98
99POSIX_Keys_Key_value_pair * _POSIX_Keys_Key_value_allocate( void );
100
101RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_free(
102  POSIX_Keys_Key_value_pair *key_value_pair
103)
104{
105  _Chain_Extract_unprotected( &key_value_pair->Key_node );
106  _Freechain_Put( &_POSIX_Keys_Keypool, key_value_pair );
107}
108
109RTEMS_INLINE_ROUTINE bool _POSIX_Keys_Key_value_equal(
110  const void        *left,
111  const RBTree_Node *right
112)
113{
114  const pthread_key_t             *the_left;
115  const POSIX_Keys_Key_value_pair *the_right;
116
117  the_left = left;
118  the_right = POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( right );
119
120  return *the_left == the_right->key;
121}
122
123RTEMS_INLINE_ROUTINE bool _POSIX_Keys_Key_value_less(
124  const void        *left,
125  const RBTree_Node *right
126)
127{
128  const pthread_key_t             *the_left;
129  const POSIX_Keys_Key_value_pair *the_right;
130
131  the_left = left;
132  the_right = POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( right );
133
134  return *the_left < the_right->key;
135}
136
137RTEMS_INLINE_ROUTINE void *_POSIX_Keys_Key_value_map( RBTree_Node *node )
138{
139  return POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( node );
140}
141
142RTEMS_INLINE_ROUTINE POSIX_Keys_Key_value_pair *_POSIX_Keys_Key_value_find(
143  pthread_key_t         key,
144  const Thread_Control *the_thread
145)
146{
147  return _RBTree_Find_inline(
148    &the_thread->Keys.Key_value_pairs,
149    &key,
150    _POSIX_Keys_Key_value_equal,
151    _POSIX_Keys_Key_value_less,
152    _POSIX_Keys_Key_value_map
153  );
154}
155
156RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_insert(
157  pthread_key_t              key,
158  POSIX_Keys_Key_value_pair *key_value_pair,
159  Thread_Control            *the_thread
160)
161{
162  _RBTree_Insert_inline(
163    &the_thread->Keys.Key_value_pairs,
164    &key_value_pair->Lookup_node,
165    &key,
166    _POSIX_Keys_Key_value_less
167  );
168}
169
170/** @} */
171
172#ifdef __cplusplus
173}
174#endif
175
176#endif
177/*  end of include file */
Note: See TracBrowser for help on using the repository browser.