summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-03-04 15:54:12 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-03-07 13:21:11 -0600
commite6c87f78724743bc74a38678f93ed579ace840f2 (patch)
treedce3962edb00574dade0c8caf837cd85b9607831 /cpukit/posix/src
parentRemove trailing whitespace in previous patches (diff)
downloadrtems-e6c87f78724743bc74a38678f93ed579ace840f2.tar.bz2
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.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/key.c11
-rw-r--r--cpukit/posix/src/keyrundestructors.c8
-rw-r--r--cpukit/posix/src/keysetspecific.c14
-rw-r--r--cpukit/posix/src/pthread.c10
4 files changed, 17 insertions, 26 deletions
diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c
index 2b32b50bcf..41bb946521 100644
--- a/cpukit/posix/src/key.c
+++ b/cpukit/posix/src/key.c
@@ -7,7 +7,7 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,8 +19,9 @@
#include "config.h"
#endif
+#include <rtems/config.h>
+
#include <rtems/posix/keyimpl.h>
-#include <rtems/posix/config.h>
#include <rtems/score/chainimpl.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/wkspace.h>
@@ -72,7 +73,7 @@ int _POSIX_Keys_Key_value_lookup_tree_compare_function(
static uint32_t _POSIX_Keys_Get_keypool_bump_count( void )
{
- uint32_t max = Configuration_POSIX_API.maximum_key_value_pairs;
+ uint32_t max = Configuration.maximum_key_value_pairs;
return _Objects_Is_unlimited( max ) ?
_Objects_Maximum_per_allocation( max ) : 0;
@@ -80,7 +81,7 @@ static uint32_t _POSIX_Keys_Get_keypool_bump_count( void )
static uint32_t _POSIX_Keys_Get_initial_keypool_size( void )
{
- uint32_t max = Configuration_POSIX_API.maximum_key_value_pairs;
+ uint32_t max = Configuration.maximum_key_value_pairs;
return _Objects_Maximum_per_allocation( max );
}
@@ -135,7 +136,7 @@ void _POSIX_Key_Manager_initialization(void)
&_POSIX_Keys_Information, /* object information table */
OBJECTS_POSIX_API, /* object API */
OBJECTS_POSIX_KEYS, /* object class */
- Configuration_POSIX_API.maximum_keys,
+ Configuration.maximum_keys,
/* maximum objects of this class */
sizeof( POSIX_Keys_Control ),
/* size of this object's control block */
diff --git a/cpukit/posix/src/keyrundestructors.c b/cpukit/posix/src/keyrundestructors.c
index 2545486940..312cf35e68 100644
--- a/cpukit/posix/src/keyrundestructors.c
+++ b/cpukit/posix/src/keyrundestructors.c
@@ -9,7 +9,7 @@
* Copyright (c) 2012 Zhongwei Yao.
* Copyright (c) 2010 embedded brains GmbH.
*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -22,8 +22,8 @@
#endif
#include <rtems/posix/keyimpl.h>
-#include <rtems/posix/threadsup.h>
#include <rtems/score/chainimpl.h>
+#include <rtems/score/thread.h>
/*
* _POSIX_Keys_Run_destructors
@@ -46,9 +46,7 @@ void _POSIX_Keys_Run_destructors(
_Thread_Disable_dispatch();
- chain = &(
- (POSIX_API_Control *)thread->API_Extensions[ THREAD_API_POSIX ]
- )->Key_Chain;
+ chain = &thread->Key_Chain;
iter = (POSIX_Keys_Key_value_pair *) _Chain_First( chain );
while ( !_Chain_Is_tail( chain, &iter->Key_values_per_thread_node ) ) {
next = (POSIX_Keys_Key_value_pair *)
diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c
index 5cfa90e4e7..c6e2d30151 100644
--- a/cpukit/posix/src/keysetspecific.c
+++ b/cpukit/posix/src/keysetspecific.c
@@ -7,7 +7,7 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -20,7 +20,7 @@
#endif
#include <rtems/posix/keyimpl.h>
-#include <rtems/posix/threadsup.h>
+#include <rtems/score/thread.h>
#include <rtems/score/chainimpl.h>
#include <errno.h>
@@ -37,7 +37,6 @@ int pthread_setspecific(
POSIX_Keys_Control *the_key;
Objects_Locations location;
POSIX_Keys_Key_value_pair *value_pair_ptr;
- POSIX_API_Control *api;
the_key = _POSIX_Keys_Get( key, &location );
switch ( location ) {
@@ -55,7 +54,7 @@ int pthread_setspecific(
value_pair_ptr->thread_id = _Thread_Executing->Object.id;
value_pair_ptr->value = value;
if ( _RBTree_Insert( &_POSIX_Keys_Key_value_lookup_tree,
- &(value_pair_ptr->Key_value_lookup_node) ) ) {
+ &(value_pair_ptr->Key_value_lookup_node) ) ) {
_Freechain_Put( (Freechain_Control *)&_POSIX_Keys_Keypool,
(void *) value_pair_ptr );
_Objects_Put( &the_key->Object );
@@ -64,9 +63,10 @@ int pthread_setspecific(
}
/** append rb_node to the thread API extension's chain */
- api = (POSIX_API_Control *)\
- (_Thread_Executing->API_Extensions[THREAD_API_POSIX]);
- _Chain_Append_unprotected( &api->Key_Chain, &value_pair_ptr->Key_values_per_thread_node );
+ _Chain_Append_unprotected(
+ &_Thread_Executing->Key_Chain,
+ &value_pair_ptr->Key_values_per_thread_node
+ );
_Objects_Put( &the_key->Object );
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 67b62ae67e..33577a22ac 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2013.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -247,9 +247,6 @@ static bool _POSIX_Threads_Create_extension(
created
);
- /** initialize thread's key vaule node chain */
- _Chain_Initialize_empty( &api->Key_Chain );
-
return true;
}
@@ -275,11 +272,6 @@ static void _POSIX_Threads_Delete_extension(
_POSIX_Threads_cancel_run( deleted );
/*
- * Run all the key destructors
- */
- _POSIX_Keys_Run_destructors( deleted );
-
- /*
* Wakeup all the tasks which joined with this one
*/
value_ptr = (void **) deleted->Wait.return_argument;