summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-06 14:46:24 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-06 15:47:57 +0200
commit2ad250e92d2978b56a9a552a0b55c1f8046312cb (patch)
treea1aa5613b23bcb54c995546be8591430e3304aea /cpukit/posix
parentpsxtests/psx14: Include missing header file (diff)
downloadrtems-2ad250e92d2978b56a9a552a0b55c1f8046312cb.tar.bz2
posix: Create key implementation header
Move implementation specific parts of key.h and key.inl into new header file keyimpl.h. The key.h contains now only the application visible API.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/Makefile.am3
-rw-r--r--cpukit/posix/include/rtems/posix/key.h105
-rw-r--r--cpukit/posix/include/rtems/posix/keyimpl.h177
-rw-r--r--cpukit/posix/inline/rtems/posix/key.inl92
-rw-r--r--cpukit/posix/preinstall.am8
-rw-r--r--cpukit/posix/src/key.c48
-rw-r--r--cpukit/posix/src/keycreate.c2
-rw-r--r--cpukit/posix/src/keydelete.c2
-rw-r--r--cpukit/posix/src/keyfreememory.c7
-rw-r--r--cpukit/posix/src/keygetspecific.c2
-rw-r--r--cpukit/posix/src/keyrundestructors.c7
-rw-r--r--cpukit/posix/src/keysetspecific.c15
-rw-r--r--cpukit/posix/src/pthread.c2
-rw-r--r--cpukit/posix/src/pthreadinitthreads.c1
14 files changed, 219 insertions, 252 deletions
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index e7ec45f81c..3947db72ea 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -30,6 +30,7 @@ include_rtems_posix_HEADERS += include/rtems/posix/cond.h
include_rtems_posix_HEADERS += include/rtems/posix/condimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/config.h
include_rtems_posix_HEADERS += include/rtems/posix/key.h
+include_rtems_posix_HEADERS += include/rtems/posix/keyimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/mqueue.h
include_rtems_posix_HEADERS += include/rtems/posix/mqueueimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/mutex.h
@@ -54,8 +55,6 @@ include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/spinlock.h
include_rtems_posix_HEADERS += include/rtems/posix/spinlockimpl.h
-include_rtems_posix_HEADERS += inline/rtems/posix/key.inl
-
## src
libposix_a_SOURCES += src/aio_cancel.c src/aio_error.c src/aio_fsync.c \
src/aio_read.c src/aio_return.c src/aio_suspend.c src/aio_write.c \
diff --git a/cpukit/posix/include/rtems/posix/key.h b/cpukit/posix/include/rtems/posix/key.h
index ee5b573c9b..9869881138 100644
--- a/cpukit/posix/include/rtems/posix/key.h
+++ b/cpukit/posix/include/rtems/posix/key.h
@@ -20,10 +20,15 @@
#ifndef _RTEMS_POSIX_KEY_H
#define _RTEMS_POSIX_KEY_H
+#include <pthread.h>
+
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
#include <rtems/score/rbtree.h>
-#include <rtems/score/chainimpl.h>
-#include <rtems/score/freechain.h>
-#include <rtems/score/objectimpl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
/**
* @defgroup POSIX_KEY POSIX Key
@@ -33,10 +38,6 @@
*/
/**@{**/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* @brief The rbtree node used to manage a POSIX key and value.
*/
@@ -54,14 +55,6 @@ typedef struct {
} POSIX_Keys_Key_value_pair;
/**
- * @brief POSIX_Keys_Freechain is used in Freechain structure
- */
-typedef struct {
- Freechain_Control super_fc;
- size_t bump_count;
-} POSIX_Keys_Freechain;
-
-/**
* @brief The data structure used to manage a POSIX key.
*/
typedef struct {
@@ -71,88 +64,6 @@ typedef struct {
void (*destructor) (void *);
} POSIX_Keys_Control;
-/**
- * @brief The information control block used to manage this class of objects.
- */
-POSIX_EXTERN Objects_Information _POSIX_Keys_Information;
-
-/**
- * @brief The rbtree control block used to manage all key values
- */
-POSIX_EXTERN RBTree_Control _POSIX_Keys_Key_value_lookup_tree;
-
-/**
- * @brief This freechain is used as a memory pool for POSIX_Keys_Key_value_pair.
- */
-POSIX_EXTERN POSIX_Keys_Freechain _POSIX_Keys_Keypool;
-
-/**
- * @brief POSIX key manager initialization.
- *
- * This routine performs the initialization necessary for this manager.
- */
-void _POSIX_Key_Manager_initialization(void);
-
-/**
- * @brief POSIX key Freechain extend handle
- *
- * This routine extend freechain node, which is called in freechain_get
- * automatically.
- */
-bool _POSIX_Keys_Freechain_extend(Freechain_Control *freechain);
-
-/**
- * @brief POSIX keys Red-Black tree node comparison.
- *
- * This routine compares the rbtree node
- */
-int _POSIX_Keys_Key_value_lookup_tree_compare_function(
- const RBTree_Node *node1,
- const RBTree_Node *node2
-);
-
-/**
- * @brief Create thread-specific data POSIX key.
- *
- * This function executes all the destructors associated with the thread's
- * keys. This function will execute until all values have been set to NULL.
- *
- * @param[in] thread is a pointer to the thread whose keys should have
- * all their destructors run.
- *
- * NOTE: This is the routine executed when a thread exits to
- * run through all the keys and do the destructor action.
- */
-void _POSIX_Keys_Run_destructors(
- Thread_Control *thread
-);
-
-/**
- * @brief Free a POSIX key table memory.
- *
- * This memory frees the key table memory associated with @a the_key.
- *
- * @param[in] the_key is a pointer to the POSIX key to free
- * the table memory of.
- */
-void _POSIX_Keys_Free_memory(
- POSIX_Keys_Control *the_key
-);
-
-/**
- * @brief Free a POSIX keys control block.
- *
- * This routine frees a keys control block to the
- * inactive chain of free keys control blocks.
- *
- * @param[in] the_key is a pointer to the POSIX key to free.
- */
-RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
- POSIX_Keys_Control *the_key
-);
-
-#include <rtems/posix/key.inl>
-
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/posix/include/rtems/posix/keyimpl.h b/cpukit/posix/include/rtems/posix/keyimpl.h
new file mode 100644
index 0000000000..33059ffeb1
--- /dev/null
+++ b/cpukit/posix/include/rtems/posix/keyimpl.h
@@ -0,0 +1,177 @@
+/**
+ * @file
+ *
+ * @brief Private Inlined Routines for POSIX Key's
+ *
+ * This include file contains the static inline implementation of the private
+ * inlined routines for POSIX key's.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <rtems/posix/key.h>
+#include <rtems/score/freechain.h>
+#include <rtems/score/objectimpl.h>
+
+#ifndef _RTEMS_POSIX_KEYIMPL_H
+#define _RTEMS_POSIX_KEYIMPL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup POSIX_KEY
+ *
+ * @{
+ */
+
+/**
+ * @brief POSIX_Keys_Freechain is used in Freechain structure
+ */
+typedef struct {
+ Freechain_Control super_fc;
+ size_t bump_count;
+} POSIX_Keys_Freechain;
+
+/**
+ * @brief The information control block used to manage this class of objects.
+ */
+POSIX_EXTERN Objects_Information _POSIX_Keys_Information;
+
+/**
+ * @brief The rbtree control block used to manage all key values
+ */
+POSIX_EXTERN RBTree_Control _POSIX_Keys_Key_value_lookup_tree;
+
+/**
+ * @brief This freechain is used as a memory pool for POSIX_Keys_Key_value_pair.
+ */
+POSIX_EXTERN POSIX_Keys_Freechain _POSIX_Keys_Keypool;
+
+/**
+ * @brief POSIX key manager initialization.
+ *
+ * This routine performs the initialization necessary for this manager.
+ */
+void _POSIX_Key_Manager_initialization(void);
+
+/**
+ * @brief POSIX key Freechain extend handle
+ *
+ * This routine extend freechain node, which is called in freechain_get
+ * automatically.
+ */
+bool _POSIX_Keys_Freechain_extend(Freechain_Control *freechain);
+
+/**
+ * @brief POSIX keys Red-Black tree node comparison.
+ *
+ * This routine compares the rbtree node
+ */
+int _POSIX_Keys_Key_value_lookup_tree_compare_function(
+ const RBTree_Node *node1,
+ const RBTree_Node *node2
+);
+
+/**
+ * @brief Create thread-specific data POSIX key.
+ *
+ * This function executes all the destructors associated with the thread's
+ * keys. This function will execute until all values have been set to NULL.
+ *
+ * @param[in] thread is a pointer to the thread whose keys should have
+ * all their destructors run.
+ *
+ * NOTE: This is the routine executed when a thread exits to
+ * run through all the keys and do the destructor action.
+ */
+void _POSIX_Keys_Run_destructors(
+ Thread_Control *thread
+);
+
+/**
+ * @brief Free a POSIX key table memory.
+ *
+ * This memory frees the key table memory associated with @a the_key.
+ *
+ * @param[in] the_key is a pointer to the POSIX key to free
+ * the table memory of.
+ */
+void _POSIX_Keys_Free_memory(
+ POSIX_Keys_Control *the_key
+);
+
+/**
+ * @brief Free a POSIX keys control block.
+ *
+ * This routine frees a keys control block to the
+ * inactive chain of free keys control blocks.
+ *
+ * @param[in] the_key is a pointer to the POSIX key to free.
+ */
+RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+);
+
+/**
+ * @brief Allocate a keys control block.
+ *
+ * This function allocates a keys control block from
+ * the inactive chain of free keys control blocks.
+ */
+
+RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
+{
+ return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
+}
+
+/**
+ * @brief Free a keys control block.
+ *
+ * This routine frees a keys control block to the
+ * inactive chain of free keys control blocks.
+ */
+RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
+ POSIX_Keys_Control *the_key
+)
+{
+ _Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
+}
+
+/**
+ * @brief Get a keys control block.
+ *
+ * This function maps key IDs to key control blocks.
+ * If ID corresponds to a local keys, then it returns
+ * the_key control pointer which maps to ID and location
+ * is set to OBJECTS_LOCAL. if the keys ID is global and
+ * resides on a remote node, then location is set to OBJECTS_REMOTE,
+ * and the_key is undefined. Otherwise, location is set
+ * to OBJECTS_ERROR and the_key is undefined.
+ */
+
+RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
+ pthread_key_t id,
+ Objects_Locations *location
+)
+{
+ return (POSIX_Keys_Control *)
+ _Objects_Get( &_POSIX_Keys_Information, (Objects_Id) id, location );
+}
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/posix/inline/rtems/posix/key.inl b/cpukit/posix/inline/rtems/posix/key.inl
deleted file mode 100644
index ce5601b06d..0000000000
--- a/cpukit/posix/inline/rtems/posix/key.inl
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * @file
- *
- * @brief Private Inlined Routines for POSIX Key's
- *
- * This include file contains the static inline implementation of the private
- * inlined routines for POSIX key's.
- */
-
-/*
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#ifndef _RTEMS_POSIX_KEY_H
-# error "Never use <rtems/posix/key.inl> directly; include <rtems/posix/key.h> instead."
-#endif
-
-#ifndef _RTEMS_POSIX_KEY_INL
-#define _RTEMS_POSIX_KEY_INL
-
-/**
- * @brief Allocate a keys control block.
- *
- * This function allocates a keys control block from
- * the inactive chain of free keys control blocks.
- */
-
-RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
-{
- return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
-}
-
-/**
- * @brief Free a keys control block.
- *
- * This routine frees a keys control block to the
- * inactive chain of free keys control blocks.
- */
-RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
- POSIX_Keys_Control *the_key
-)
-{
- _Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
-}
-
-/**
- * @brief Get a keys control block.
- *
- * This function maps key IDs to key control blocks.
- * If ID corresponds to a local keys, then it returns
- * the_key control pointer which maps to ID and location
- * is set to OBJECTS_LOCAL. if the keys ID is global and
- * resides on a remote node, then location is set to OBJECTS_REMOTE,
- * and the_key is undefined. Otherwise, location is set
- * to OBJECTS_ERROR and the_key is undefined.
- */
-
-RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
- pthread_key_t id,
- Objects_Locations *location
-)
-{
- return (POSIX_Keys_Control *)
- _Objects_Get( &_POSIX_Keys_Information, (Objects_Id) id, location );
-}
-
-/**
- * @brief Check if a keys control block is NULL.
- *
- * This function returns @c TRUE if the_key is @c NULL and @c FALSE
- * otherwise.
- *
- * @param[in] the_key is the pointer to the key control block to be checked.
- *
- * @retval TRUE The key control block is @c NULL.
- * @retval FALSE The key control block is not @c NULL.
- */
-RTEMS_INLINE_ROUTINE bool _POSIX_Keys_Is_null (
- POSIX_Keys_Control *the_key
-)
-{
- return !the_key;
-}
-
-#endif
-/* end of include file */
-
diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am
index 3ae3896ec9..093a9df914 100644
--- a/cpukit/posix/preinstall.am
+++ b/cpukit/posix/preinstall.am
@@ -64,6 +64,10 @@ $(PROJECT_INCLUDE)/rtems/posix/key.h: include/rtems/posix/key.h $(PROJECT_INCLUD
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/key.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/key.h
+$(PROJECT_INCLUDE)/rtems/posix/keyimpl.h: include/rtems/posix/keyimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/keyimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/keyimpl.h
+
$(PROJECT_INCLUDE)/rtems/posix/mqueue.h: include/rtems/posix/mqueue.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/mqueue.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/mqueue.h
@@ -155,8 +159,4 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
$(PROJECT_INCLUDE)/rtems/posix/spinlockimpl.h: include/rtems/posix/spinlockimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlockimpl.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlockimpl.h
-
-$(PROJECT_INCLUDE)/rtems/posix/key.inl: inline/rtems/posix/key.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/key.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/key.inl
endif
diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c
index 2bb415c4d5..99654c2da4 100644
--- a/cpukit/posix/src/key.c
+++ b/cpukit/posix/src/key.c
@@ -19,24 +19,10 @@
#include "config.h"
#endif
-#include <errno.h>
-#include <limits.h>
-#include <pthread.h>
-#include <string.h>
-#include <limits.h>
-
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/thread.h>
+#include <rtems/posix/keyimpl.h>
+#include <rtems/posix/config.h>
+#include <rtems/score/chainimpl.h>
#include <rtems/score/wkspace.h>
-#include <rtems/posix/key.h>
-#include <rtems/score/rbtree.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/freechain.h>
-
-/* forward declarations to avoid warnings */
-void _POSIX_Keys_Keypool_init(void);
-void _POSIX_Keys_Freechain_init(Freechain_Control *freechain);
/**
* @brief This routine compares the rbtree node by comparing POSIX key first
@@ -84,22 +70,9 @@ int _POSIX_Keys_Key_value_lookup_tree_compare_function(
}
/**
- * @brief This routine does keypool initialize, keypool contains all
- * POSIX_Keys_Key_value_pair
- */
-
-void _POSIX_Keys_Keypool_init(void)
-{
- _Freechain_Initialize((Freechain_Control *)&_POSIX_Keys_Keypool,
- &_POSIX_Keys_Freechain_extend);
-
- _POSIX_Keys_Freechain_init((Freechain_Control *)&_POSIX_Keys_Keypool);
-}
-
-/**
* @brief This routine does user side freechain initialization
*/
-void _POSIX_Keys_Freechain_init(Freechain_Control *freechain)
+static void _POSIX_Keys_Freechain_init(Freechain_Control *freechain)
{
POSIX_Keys_Freechain *psx_freechain_p = (POSIX_Keys_Freechain *)freechain;
psx_freechain_p->bump_count =
@@ -116,6 +89,19 @@ void _POSIX_Keys_Freechain_init(Freechain_Control *freechain)
}
/**
+ * @brief This routine does keypool initialize, keypool contains all
+ * POSIX_Keys_Key_value_pair
+ */
+
+static void _POSIX_Keys_Keypool_init(void)
+{
+ _Freechain_Initialize((Freechain_Control *)&_POSIX_Keys_Keypool,
+ &_POSIX_Keys_Freechain_extend);
+
+ _POSIX_Keys_Freechain_init((Freechain_Control *)&_POSIX_Keys_Keypool);
+}
+
+/**
* @brief This routine is user defined freechain extension handle
*/
bool _POSIX_Keys_Freechain_extend(Freechain_Control *freechain)
diff --git a/cpukit/posix/src/keycreate.c b/cpukit/posix/src/keycreate.c
index 349e88378a..4a0f7842c2 100644
--- a/cpukit/posix/src/keycreate.c
+++ b/cpukit/posix/src/keycreate.c
@@ -26,7 +26,7 @@
#include <rtems/system.h>
#include <rtems/score/thread.h>
#include <rtems/score/wkspace.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
/**
* 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
diff --git a/cpukit/posix/src/keydelete.c b/cpukit/posix/src/keydelete.c
index c3d3da1a3b..5863a40f02 100644
--- a/cpukit/posix/src/keydelete.c
+++ b/cpukit/posix/src/keydelete.c
@@ -26,7 +26,7 @@
#include <rtems/system.h>
#include <rtems/score/thread.h>
#include <rtems/score/wkspace.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
/*
* 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
diff --git a/cpukit/posix/src/keyfreememory.c b/cpukit/posix/src/keyfreememory.c
index c42616dcb0..d971d0a95e 100644
--- a/cpukit/posix/src/keyfreememory.c
+++ b/cpukit/posix/src/keyfreememory.c
@@ -19,11 +19,8 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/rbtree.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
+#include <rtems/score/chainimpl.h>
void _POSIX_Keys_Free_memory(
POSIX_Keys_Control *the_key
diff --git a/cpukit/posix/src/keygetspecific.c b/cpukit/posix/src/keygetspecific.c
index 88e084ee96..568a98cf71 100644
--- a/cpukit/posix/src/keygetspecific.c
+++ b/cpukit/posix/src/keygetspecific.c
@@ -28,7 +28,7 @@
#include <rtems/score/thread.h>
#include <rtems/score/wkspace.h>
#include <rtems/score/rbtree.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
/*
* 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
diff --git a/cpukit/posix/src/keyrundestructors.c b/cpukit/posix/src/keyrundestructors.c
index 7e3c88fdb6..d151f4f5ae 100644
--- a/cpukit/posix/src/keyrundestructors.c
+++ b/cpukit/posix/src/keyrundestructors.c
@@ -21,12 +21,9 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/chain.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
#include <rtems/posix/threadsup.h>
+#include <rtems/score/chainimpl.h>
/*
* _POSIX_Keys_Run_destructors
diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c
index f527fe1ee4..4a1adb68b5 100644
--- a/cpukit/posix/src/keysetspecific.c
+++ b/cpukit/posix/src/keysetspecific.c
@@ -19,18 +19,11 @@
#include "config.h"
#endif
-#include <errno.h>
-#include <limits.h>
-#include <pthread.h>
-#include <string.h>
-#include <stddef.h>
-
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/score/rbtree.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
#include <rtems/posix/threadsup.h>
+#include <rtems/score/chainimpl.h>
+
+#include <errno.h>
/*
* 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 13f7525c75..408bb07dc4 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -36,7 +36,7 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/psignalimpl.h>
#include <rtems/posix/config.h>
-#include <rtems/posix/key.h>
+#include <rtems/posix/keyimpl.h>
#include <rtems/posix/time.h>
#include <rtems/score/timespec.h>
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c
index 9f2f468d8c..961105c669 100644
--- a/cpukit/posix/src/pthreadinitthreads.c
+++ b/cpukit/posix/src/pthreadinitthreads.c
@@ -32,7 +32,6 @@
#include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/config.h>
-#include <rtems/posix/key.h>
#include <rtems/posix/time.h>
void _POSIX_Threads_Initialize_user_threads_body(void)