summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-01 22:33:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-01 22:33:47 +0000
commit3c46587833f88c89314050674a81d8e9ed6e6f80 (patch)
treef0926bbad67f5213ecbe1d67d20226c2cb6f525e
parent2002-07-01 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-3c46587833f88c89314050674a81d8e9ed6e6f80.tar.bz2
2002-07-01 Joel Sherrill <joel@OARcorp.com>
* Mega patch merge to change the format of the object IDs to loosen the dependency between the SCORE and the various APIs. There was considerable work to simplify the object name management and it appears that the name_table field is no longer needed. This patch also includes the addition of the internal mutex which is currently only used to protect some types of allocation and deallocation. This significantly can reduce context switch latency under certain circumstances. In particular, some heap/region operations were O(n) and had dispatching disabled. This should help enormously. With this merge, the patch is not as clean as it should be. In particular, the documentation has not been modified to reflect the new object ID layout, the IDs in the test screens are not updated, and _Objects_Get_information needs to be a real routine not inlined. As part of this patch a lot of MP code for thread/proxy blocking was made conditional and cleaned up. * include/rtems/posix/key.h, src/cond.c, src/condinit.c, src/intr.c, src/key.c, src/keycreate.c, src/keydelete.c, src/killinfo.c, src/mqueue.c, src/mqueuecreatesupp.c, src/mutex.c, src/mutexinit.c, src/psignal.c, src/pthread.c, src/semaphore.c, src/semaphorecreatesupp.c: Modified as part of above.
-rw-r--r--c/src/exec/posix/ChangeLog24
-rw-r--r--c/src/exec/posix/include/rtems/posix/key.h2
-rw-r--r--c/src/exec/posix/src/cond.c21
-rw-r--r--c/src/exec/posix/src/condinit.c6
-rw-r--r--c/src/exec/posix/src/intr.c19
-rw-r--r--c/src/exec/posix/src/key.c19
-rw-r--r--c/src/exec/posix/src/keycreate.c25
-rw-r--r--c/src/exec/posix/src/keydelete.c12
-rw-r--r--c/src/exec/posix/src/killinfo.c15
-rw-r--r--c/src/exec/posix/src/mqueue.c32
-rw-r--r--c/src/exec/posix/src/mqueuecreatesupp.c8
-rw-r--r--c/src/exec/posix/src/mutex.c19
-rw-r--r--c/src/exec/posix/src/mutexinit.c4
-rw-r--r--c/src/exec/posix/src/psignal.c2
-rw-r--r--c/src/exec/posix/src/pthread.c26
-rw-r--r--c/src/exec/posix/src/semaphore.c19
-rw-r--r--c/src/exec/posix/src/semaphorecreatesupp.c8
-rw-r--r--cpukit/posix/ChangeLog24
-rw-r--r--cpukit/posix/include/rtems/posix/key.h2
-rw-r--r--cpukit/posix/src/cond.c21
-rw-r--r--cpukit/posix/src/condinit.c6
-rw-r--r--cpukit/posix/src/intr.c19
-rw-r--r--cpukit/posix/src/key.c19
-rw-r--r--cpukit/posix/src/keycreate.c25
-rw-r--r--cpukit/posix/src/keydelete.c12
-rw-r--r--cpukit/posix/src/killinfo.c15
-rw-r--r--cpukit/posix/src/mqueue.c32
-rw-r--r--cpukit/posix/src/mqueuecreatesupp.c8
-rw-r--r--cpukit/posix/src/mutex.c19
-rw-r--r--cpukit/posix/src/mutexinit.c4
-rw-r--r--cpukit/posix/src/psignal.c2
-rw-r--r--cpukit/posix/src/pthread.c26
-rw-r--r--cpukit/posix/src/semaphore.c19
-rw-r--r--cpukit/posix/src/semaphorecreatesupp.c8
34 files changed, 304 insertions, 218 deletions
diff --git a/c/src/exec/posix/ChangeLog b/c/src/exec/posix/ChangeLog
index 5dd31bed11..374c7ab3fc 100644
--- a/c/src/exec/posix/ChangeLog
+++ b/c/src/exec/posix/ChangeLog
@@ -1,3 +1,27 @@
+2002-07-01 Joel Sherrill <joel@OARcorp.com>
+
+ * Mega patch merge to change the format of the object IDs to
+ loosen the dependency between the SCORE and the various APIs.
+ There was considerable work to simplify the object name management
+ and it appears that the name_table field is no longer needed.
+ This patch also includes the addition of the internal mutex
+ which is currently only used to protect some types of allocation
+ and deallocation. This significantly can reduce context
+ switch latency under certain circumstances. In particular,
+ some heap/region operations were O(n) and had dispatching
+ disabled. This should help enormously. With this merge,
+ the patch is not as clean as it should be. In particular,
+ the documentation has not been modified to reflect the new object
+ ID layout, the IDs in the test screens are not updated, and
+ _Objects_Get_information needs to be a real routine not inlined.
+ As part of this patch a lot of MP code for thread/proxy blocking
+ was made conditional and cleaned up.
+ * include/rtems/posix/key.h, src/cond.c, src/condinit.c, src/intr.c,
+ src/key.c, src/keycreate.c, src/keydelete.c, src/killinfo.c,
+ src/mqueue.c, src/mqueuecreatesupp.c, src/mutex.c, src/mutexinit.c,
+ src/psignal.c, src/pthread.c, src/semaphore.c,
+ src/semaphorecreatesupp.c: Modified as part of above.
+
2002-07-01 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove RTEMS_PROJECT_ROOT.
diff --git a/c/src/exec/posix/include/rtems/posix/key.h b/c/src/exec/posix/include/rtems/posix/key.h
index ddebf6f0ee..b45539baae 100644
--- a/c/src/exec/posix/include/rtems/posix/key.h
+++ b/c/src/exec/posix/include/rtems/posix/key.h
@@ -31,7 +31,7 @@ typedef struct {
Objects_Control Object;
boolean is_active;
void (*destructor)( void * );
- void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
+ void **Values[ OBJECTS_APIS_LAST + 1 ];
} POSIX_Keys_Control;
/*
diff --git a/c/src/exec/posix/src/cond.c b/c/src/exec/posix/src/cond.c
index df3780290f..f02a62275f 100644
--- a/c/src/exec/posix/src/cond.c
+++ b/c/src/exec/posix/src/cond.c
@@ -35,13 +35,18 @@ void _POSIX_Condition_variables_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Condition_variables_Information,
- OBJECTS_POSIX_CONDITION_VARIABLES,
- TRUE,
- maximum_condition_variables,
+ &_POSIX_Condition_variables_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_CONDITION_VARIABLES, /* object class */
+ maximum_condition_variables, /* maximum objects of this class */
sizeof( POSIX_Condition_variables_Control ),
- FALSE,
- 0,
- FALSE
- );
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
+ );
}
diff --git a/c/src/exec/posix/src/condinit.c b/c/src/exec/posix/src/condinit.c
index c227299bfe..cab76e4ab1 100644
--- a/c/src/exec/posix/src/condinit.c
+++ b/c/src/exec/posix/src/condinit.c
@@ -70,14 +70,8 @@ int pthread_cond_init(
/* XXX some more initialization might need to go here */
_Thread_queue_Initialize(
&the_cond->Wait_queue,
- OBJECTS_POSIX_CONDITION_VARIABLES,
THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_CONDITION_VARIABLE,
-#if defined(RTEMS_MULTIPROCESSING)
- _POSIX_Condition_variables_MP_Send_extract_proxy,
-#else
- NULL,
-#endif
ETIMEDOUT
);
diff --git a/c/src/exec/posix/src/intr.c b/c/src/exec/posix/src/intr.c
index 251d0cb2d4..7688142ddf 100644
--- a/c/src/exec/posix/src/intr.c
+++ b/c/src/exec/posix/src/intr.c
@@ -41,14 +41,19 @@ void _POSIX_Interrupt_Manager_initialization(
POSIX_Interrupt_Control *the_vector;
_Objects_Initialize_information(
- &_POSIX_Interrupt_Handlers_Information,
- OBJECTS_POSIX_INTERRUPTS,
- FALSE,
- maximum_interrupt_handlers,
+ &_POSIX_Interrupt_Handlers_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_INTERRUPTS, /* object class */
+ maximum_interrupt_handlers, /* maximum objects of this class */
sizeof( POSIX_Interrupt_Handler_control ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
for ( index=0 ; index < CPU_INTERRUPT_NUMBER_OF_VECTORS ; index++ ) {
diff --git a/c/src/exec/posix/src/key.c b/c/src/exec/posix/src/key.c
index fb92a9bb79..54f7213424 100644
--- a/c/src/exec/posix/src/key.c
+++ b/c/src/exec/posix/src/key.c
@@ -29,13 +29,18 @@ void _POSIX_Key_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Keys_Information,
- OBJECTS_POSIX_KEYS,
- FALSE,
- maximum_keys,
+ &_POSIX_Keys_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_KEYS, /* object class */
+ maximum_keys, /* maximum objects of this class */
sizeof( POSIX_Keys_Control ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/c/src/exec/posix/src/keycreate.c b/c/src/exec/posix/src/keycreate.c
index bf3f7501cb..bcb881e756 100644
--- a/c/src/exec/posix/src/keycreate.c
+++ b/c/src/exec/posix/src/keycreate.c
@@ -28,7 +28,7 @@ int pthread_key_create(
{
POSIX_Keys_Control *the_key;
void *table;
- unsigned32 the_class;
+ unsigned32 the_api;
unsigned32 bytes_to_allocate;
@@ -49,29 +49,30 @@ int pthread_key_create(
* for. [NOTE: Currently RTEMS Classic API tasks are not always enabled.]
*/
- for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
- the_class++ ) {
+ for ( the_api = 1;
+ the_api <= OBJECTS_APIS_LAST;
+ the_api++ ) {
- if ( _Objects_Information_table[ the_class ] ) {
+ if ( _Objects_Information_table[ the_api ] &&
+ _Objects_Information_table[ the_api ][ 1 ] ) {
bytes_to_allocate = sizeof( void * ) *
- (_Objects_Information_table[ the_class ]->maximum + 1);
+ (_Objects_Information_table[ the_api ][ 1 ]->maximum + 1);
table = _Workspace_Allocate( bytes_to_allocate );
if ( !table ) {
- for ( --the_class;
- the_class >= OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class-- )
- _Workspace_Free( the_key->Values[ the_class ] );
+ for ( --the_api;
+ the_api >= 1;
+ the_api-- )
+ _Workspace_Free( the_key->Values[ the_api ] );
_POSIX_Keys_Free( the_key );
_Thread_Enable_dispatch();
return ENOMEM;
}
- the_key->Values[ the_class ] = table;
+ the_key->Values[ the_api ] = table;
memset( table, '\0', bytes_to_allocate );
} else {
- the_key->Values[ the_class ] = NULL;
+ the_key->Values[ the_api ] = NULL;
}
diff --git a/c/src/exec/posix/src/keydelete.c b/c/src/exec/posix/src/keydelete.c
index 6c2fa4be36..1d595f2b8e 100644
--- a/c/src/exec/posix/src/keydelete.c
+++ b/c/src/exec/posix/src/keydelete.c
@@ -27,7 +27,7 @@ int pthread_key_delete(
{
register POSIX_Keys_Control *the_key;
Objects_Locations location;
- unsigned32 the_class;
+ unsigned32 the_api;
the_key = _POSIX_Keys_Get( key, &location );
switch ( location ) {
@@ -39,11 +39,11 @@ int pthread_key_delete(
the_key->is_active = FALSE;
- for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
- the_class++ )
- if ( the_key->Values[ the_class ] )
- _Workspace_Free( the_key->Values[ the_class ] );
+ for ( the_api = 1;
+ the_api <= OBJECTS_APIS_LAST;
+ the_api++ )
+ if ( the_key->Values[ the_api ] )
+ _Workspace_Free( the_key->Values[ the_api ] );
/*
* NOTE: The destructor is not called and it is the responsibility
diff --git a/c/src/exec/posix/src/killinfo.c b/c/src/exec/posix/src/killinfo.c
index ae6067ab16..0d72a6ee9a 100644
--- a/c/src/exec/posix/src/killinfo.c
+++ b/c/src/exec/posix/src/killinfo.c
@@ -44,7 +44,7 @@ int killinfo(
{
sigset_t mask;
POSIX_API_Control *api;
- unsigned32 the_class;
+ unsigned32 the_api;
unsigned32 index;
unsigned32 maximum;
Objects_Information *the_info;
@@ -170,14 +170,17 @@ int killinfo(
interested_thread = NULL;
interested_priority = PRIORITY_MAXIMUM + 1;
- for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
- the_class++ ) {
+ for ( the_api = 2;
+ the_api <= OBJECTS_APIS_LAST;
+ the_api++ ) {
- if ( the_class == OBJECTS_INTERNAL_THREADS )
+ if ( the_api == OBJECTS_INTERNAL_THREADS )
continue;
- the_info = _Objects_Information_table[ the_class ];
+ if ( !_Objects_Information_table[ the_api ] ) /* API not installed */
+ continue;
+
+ the_info = _Objects_Information_table[ the_api ][ 1 ];
if ( !the_info ) /* manager not installed */
continue;
diff --git a/c/src/exec/posix/src/mqueue.c b/c/src/exec/posix/src/mqueue.c
index 5d3c39bd72..8a97d50505 100644
--- a/c/src/exec/posix/src/mqueue.c
+++ b/c/src/exec/posix/src/mqueue.c
@@ -49,23 +49,33 @@ void _POSIX_Message_queue_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Message_queue_Information,
- OBJECTS_POSIX_MESSAGE_QUEUES,
- TRUE,
- maximum_message_queues,
+ &_POSIX_Message_queue_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_MESSAGE_QUEUES, /* object class */
+ maximum_message_queues, /* maximum objects of this class */
sizeof( POSIX_Message_queue_Control ),
- TRUE,
- _POSIX_PATH_MAX,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ _POSIX_PATH_MAX /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
_Objects_Initialize_information(
&_POSIX_Message_queue_Information_fds,
+ OBJECTS_POSIX_API,
OBJECTS_POSIX_MESSAGE_QUEUE_FDS,
- FALSE,
maximum_message_queues,
sizeof( POSIX_Message_queue_Control_fd ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/c/src/exec/posix/src/mqueuecreatesupp.c b/c/src/exec/posix/src/mqueuecreatesupp.c
index 35b3e1b826..e71e0c6092 100644
--- a/c/src/exec/posix/src/mqueuecreatesupp.c
+++ b/c/src/exec/posix/src/mqueuecreatesupp.c
@@ -111,15 +111,9 @@ int _POSIX_Message_queue_Create_support(
if ( ! _CORE_message_queue_Initialize(
&the_mq->Message_queue,
- OBJECTS_POSIX_MESSAGE_QUEUES,
the_mq_attr,
attr.mq_maxmsg,
- attr.mq_msgsize,
-#if 0 && defined(RTEMS_MULTIPROCESSING)
- _POSIX_Message_queue_MP_Send_extract_proxy
-#else
- NULL
-#endif
+ attr.mq_msgsize
) ) {
#if 0 && defined(RTEMS_MULTIPROCESSING)
diff --git a/c/src/exec/posix/src/mutex.c b/c/src/exec/posix/src/mutex.c
index d848c11559..89f9040814 100644
--- a/c/src/exec/posix/src/mutex.c
+++ b/c/src/exec/posix/src/mutex.c
@@ -37,13 +37,18 @@ void _POSIX_Mutex_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Mutex_Information,
- OBJECTS_POSIX_MUTEXES,
- TRUE,
- maximum_mutexes,
+ &_POSIX_Mutex_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_MUTEXES, /* object class */
+ maximum_mutexes, /* maximum objects of this class */
sizeof( POSIX_Mutex_Control ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/c/src/exec/posix/src/mutexinit.c b/c/src/exec/posix/src/mutexinit.c
index 84a0c2b5b7..97882040f9 100644
--- a/c/src/exec/posix/src/mutexinit.c
+++ b/c/src/exec/posix/src/mutexinit.c
@@ -163,10 +163,8 @@ int pthread_mutex_init(
_CORE_mutex_Initialize(
&the_mutex->Mutex,
- OBJECTS_POSIX_MUTEXES,
the_mutex_attr,
- CORE_MUTEX_UNLOCKED,
- NULL /* proxy_extract_callout */
+ CORE_MUTEX_UNLOCKED
);
_Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
diff --git a/c/src/exec/posix/src/psignal.c b/c/src/exec/posix/src/psignal.c
index 506ef00c6c..f93b6cc7c1 100644
--- a/c/src/exec/posix/src/psignal.c
+++ b/c/src/exec/posix/src/psignal.c
@@ -225,10 +225,8 @@ void _POSIX_signals_Manager_Initialization(
_Thread_queue_Initialize(
&_POSIX_signals_Wait_queue,
- OBJECTS_NO_CLASS,
THREAD_QUEUE_DISCIPLINE_PRIORITY,
STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
- NULL,
EAGAIN
);
diff --git a/c/src/exec/posix/src/pthread.c b/c/src/exec/posix/src/pthread.c
index 9281b5fe11..e1bade3baf 100644
--- a/c/src/exec/posix/src/pthread.c
+++ b/c/src/exec/posix/src/pthread.c
@@ -167,20 +167,17 @@ boolean _POSIX_Threads_Create_extension(
/* XXX use signal constants */
api->signals_pending = 0;
- if ( _Objects_Get_class( created->Object.id ) == OBJECTS_POSIX_THREADS ) {
+ if ( _Objects_Get_API( created->Object.id ) == OBJECTS_POSIX_API &&
+ _Objects_Get_class( created->Object.id ) == 1 ) {
executing_api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
api->signals_blocked = api->signals_blocked;
} else
api->signals_blocked = 0xffffffff;
-/* XXX set signal parameters -- block all signals for non-posix threads */
-
_Thread_queue_Initialize(
&api->Join_List,
- OBJECTS_NO_CLASS, /* only used for proxy operations */
THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_JOIN_AT_EXIT,
- NULL, /* no extract proxy handler */
0
);
@@ -356,14 +353,19 @@ void _POSIX_Threads_Manager_initialization(
#endif
_Objects_Initialize_information(
- &_POSIX_Threads_Information,
- OBJECTS_POSIX_THREADS,
- FALSE, /* does not support global */
- maximum_pthreads,
+ &_POSIX_Threads_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_THREADS, /* object class */
+ maximum_pthreads, /* maximum objects of this class */
sizeof( Thread_Control ),
- FALSE,
- 0, /* length is arbitrary for now */
- TRUE /* this class is threads */
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
/*
diff --git a/c/src/exec/posix/src/semaphore.c b/c/src/exec/posix/src/semaphore.c
index c473dfed4b..e3f6ec9c84 100644
--- a/c/src/exec/posix/src/semaphore.c
+++ b/c/src/exec/posix/src/semaphore.c
@@ -37,13 +37,18 @@ void _POSIX_Semaphore_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Semaphore_Information,
- OBJECTS_POSIX_SEMAPHORES,
- TRUE,
- maximum_semaphores,
+ &_POSIX_Semaphore_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_SEMAPHORES, /* object class */
+ maximum_semaphores /* maximum objects of this class */,
sizeof( POSIX_Semaphore_Control ),
- TRUE,
- _POSIX_PATH_MAX,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ _POSIX_PATH_MAX /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/c/src/exec/posix/src/semaphorecreatesupp.c b/c/src/exec/posix/src/semaphorecreatesupp.c
index e45d4d808a..86b1179660 100644
--- a/c/src/exec/posix/src/semaphorecreatesupp.c
+++ b/c/src/exec/posix/src/semaphorecreatesupp.c
@@ -100,13 +100,7 @@ int _POSIX_Semaphore_Create_support(
the_sem_attr->maximum_count = 0xFFFFFFFF;
- _CORE_semaphore_Initialize(
- &the_semaphore->Semaphore,
- OBJECTS_POSIX_SEMAPHORES,
- the_sem_attr,
- value,
- NULL /* multiprocessing is not supported */
- );
+ _CORE_semaphore_Initialize( &the_semaphore->Semaphore, the_sem_attr, value );
/*
* Make the semaphore available for use.
diff --git a/cpukit/posix/ChangeLog b/cpukit/posix/ChangeLog
index 5dd31bed11..374c7ab3fc 100644
--- a/cpukit/posix/ChangeLog
+++ b/cpukit/posix/ChangeLog
@@ -1,3 +1,27 @@
+2002-07-01 Joel Sherrill <joel@OARcorp.com>
+
+ * Mega patch merge to change the format of the object IDs to
+ loosen the dependency between the SCORE and the various APIs.
+ There was considerable work to simplify the object name management
+ and it appears that the name_table field is no longer needed.
+ This patch also includes the addition of the internal mutex
+ which is currently only used to protect some types of allocation
+ and deallocation. This significantly can reduce context
+ switch latency under certain circumstances. In particular,
+ some heap/region operations were O(n) and had dispatching
+ disabled. This should help enormously. With this merge,
+ the patch is not as clean as it should be. In particular,
+ the documentation has not been modified to reflect the new object
+ ID layout, the IDs in the test screens are not updated, and
+ _Objects_Get_information needs to be a real routine not inlined.
+ As part of this patch a lot of MP code for thread/proxy blocking
+ was made conditional and cleaned up.
+ * include/rtems/posix/key.h, src/cond.c, src/condinit.c, src/intr.c,
+ src/key.c, src/keycreate.c, src/keydelete.c, src/killinfo.c,
+ src/mqueue.c, src/mqueuecreatesupp.c, src/mutex.c, src/mutexinit.c,
+ src/psignal.c, src/pthread.c, src/semaphore.c,
+ src/semaphorecreatesupp.c: Modified as part of above.
+
2002-07-01 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove RTEMS_PROJECT_ROOT.
diff --git a/cpukit/posix/include/rtems/posix/key.h b/cpukit/posix/include/rtems/posix/key.h
index ddebf6f0ee..b45539baae 100644
--- a/cpukit/posix/include/rtems/posix/key.h
+++ b/cpukit/posix/include/rtems/posix/key.h
@@ -31,7 +31,7 @@ typedef struct {
Objects_Control Object;
boolean is_active;
void (*destructor)( void * );
- void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
+ void **Values[ OBJECTS_APIS_LAST + 1 ];
} POSIX_Keys_Control;
/*
diff --git a/cpukit/posix/src/cond.c b/cpukit/posix/src/cond.c
index df3780290f..f02a62275f 100644
--- a/cpukit/posix/src/cond.c
+++ b/cpukit/posix/src/cond.c
@@ -35,13 +35,18 @@ void _POSIX_Condition_variables_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Condition_variables_Information,
- OBJECTS_POSIX_CONDITION_VARIABLES,
- TRUE,
- maximum_condition_variables,
+ &_POSIX_Condition_variables_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_CONDITION_VARIABLES, /* object class */
+ maximum_condition_variables, /* maximum objects of this class */
sizeof( POSIX_Condition_variables_Control ),
- FALSE,
- 0,
- FALSE
- );
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
+ );
}
diff --git a/cpukit/posix/src/condinit.c b/cpukit/posix/src/condinit.c
index c227299bfe..cab76e4ab1 100644
--- a/cpukit/posix/src/condinit.c
+++ b/cpukit/posix/src/condinit.c
@@ -70,14 +70,8 @@ int pthread_cond_init(
/* XXX some more initialization might need to go here */
_Thread_queue_Initialize(
&the_cond->Wait_queue,
- OBJECTS_POSIX_CONDITION_VARIABLES,
THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_CONDITION_VARIABLE,
-#if defined(RTEMS_MULTIPROCESSING)
- _POSIX_Condition_variables_MP_Send_extract_proxy,
-#else
- NULL,
-#endif
ETIMEDOUT
);
diff --git a/cpukit/posix/src/intr.c b/cpukit/posix/src/intr.c
index 251d0cb2d4..7688142ddf 100644
--- a/cpukit/posix/src/intr.c
+++ b/cpukit/posix/src/intr.c
@@ -41,14 +41,19 @@ void _POSIX_Interrupt_Manager_initialization(
POSIX_Interrupt_Control *the_vector;
_Objects_Initialize_information(
- &_POSIX_Interrupt_Handlers_Information,
- OBJECTS_POSIX_INTERRUPTS,
- FALSE,
- maximum_interrupt_handlers,
+ &_POSIX_Interrupt_Handlers_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_INTERRUPTS, /* object class */
+ maximum_interrupt_handlers, /* maximum objects of this class */
sizeof( POSIX_Interrupt_Handler_control ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
for ( index=0 ; index < CPU_INTERRUPT_NUMBER_OF_VECTORS ; index++ ) {
diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c
index fb92a9bb79..54f7213424 100644
--- a/cpukit/posix/src/key.c
+++ b/cpukit/posix/src/key.c
@@ -29,13 +29,18 @@ void _POSIX_Key_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Keys_Information,
- OBJECTS_POSIX_KEYS,
- FALSE,
- maximum_keys,
+ &_POSIX_Keys_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_KEYS, /* object class */
+ maximum_keys, /* maximum objects of this class */
sizeof( POSIX_Keys_Control ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/cpukit/posix/src/keycreate.c b/cpukit/posix/src/keycreate.c
index bf3f7501cb..bcb881e756 100644
--- a/cpukit/posix/src/keycreate.c
+++ b/cpukit/posix/src/keycreate.c
@@ -28,7 +28,7 @@ int pthread_key_create(
{
POSIX_Keys_Control *the_key;
void *table;
- unsigned32 the_class;
+ unsigned32 the_api;
unsigned32 bytes_to_allocate;
@@ -49,29 +49,30 @@ int pthread_key_create(
* for. [NOTE: Currently RTEMS Classic API tasks are not always enabled.]
*/
- for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
- the_class++ ) {
+ for ( the_api = 1;
+ the_api <= OBJECTS_APIS_LAST;
+ the_api++ ) {
- if ( _Objects_Information_table[ the_class ] ) {
+ if ( _Objects_Information_table[ the_api ] &&
+ _Objects_Information_table[ the_api ][ 1 ] ) {
bytes_to_allocate = sizeof( void * ) *
- (_Objects_Information_table[ the_class ]->maximum + 1);
+ (_Objects_Information_table[ the_api ][ 1 ]->maximum + 1);
table = _Workspace_Allocate( bytes_to_allocate );
if ( !table ) {
- for ( --the_class;
- the_class >= OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class-- )
- _Workspace_Free( the_key->Values[ the_class ] );
+ for ( --the_api;
+ the_api >= 1;
+ the_api-- )
+ _Workspace_Free( the_key->Values[ the_api ] );
_POSIX_Keys_Free( the_key );
_Thread_Enable_dispatch();
return ENOMEM;
}
- the_key->Values[ the_class ] = table;
+ the_key->Values[ the_api ] = table;
memset( table, '\0', bytes_to_allocate );
} else {
- the_key->Values[ the_class ] = NULL;
+ the_key->Values[ the_api ] = NULL;
}
diff --git a/cpukit/posix/src/keydelete.c b/cpukit/posix/src/keydelete.c
index 6c2fa4be36..1d595f2b8e 100644
--- a/cpukit/posix/src/keydelete.c
+++ b/cpukit/posix/src/keydelete.c
@@ -27,7 +27,7 @@ int pthread_key_delete(
{
register POSIX_Keys_Control *the_key;
Objects_Locations location;
- unsigned32 the_class;
+ unsigned32 the_api;
the_key = _POSIX_Keys_Get( key, &location );
switch ( location ) {
@@ -39,11 +39,11 @@ int pthread_key_delete(
the_key->is_active = FALSE;
- for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
- the_class++ )
- if ( the_key->Values[ the_class ] )
- _Workspace_Free( the_key->Values[ the_class ] );
+ for ( the_api = 1;
+ the_api <= OBJECTS_APIS_LAST;
+ the_api++ )
+ if ( the_key->Values[ the_api ] )
+ _Workspace_Free( the_key->Values[ the_api ] );
/*
* NOTE: The destructor is not called and it is the responsibility
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index ae6067ab16..0d72a6ee9a 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -44,7 +44,7 @@ int killinfo(
{
sigset_t mask;
POSIX_API_Control *api;
- unsigned32 the_class;
+ unsigned32 the_api;
unsigned32 index;
unsigned32 maximum;
Objects_Information *the_info;
@@ -170,14 +170,17 @@ int killinfo(
interested_thread = NULL;
interested_priority = PRIORITY_MAXIMUM + 1;
- for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
- the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
- the_class++ ) {
+ for ( the_api = 2;
+ the_api <= OBJECTS_APIS_LAST;
+ the_api++ ) {
- if ( the_class == OBJECTS_INTERNAL_THREADS )
+ if ( the_api == OBJECTS_INTERNAL_THREADS )
continue;
- the_info = _Objects_Information_table[ the_class ];
+ if ( !_Objects_Information_table[ the_api ] ) /* API not installed */
+ continue;
+
+ the_info = _Objects_Information_table[ the_api ][ 1 ];
if ( !the_info ) /* manager not installed */
continue;
diff --git a/cpukit/posix/src/mqueue.c b/cpukit/posix/src/mqueue.c
index 5d3c39bd72..8a97d50505 100644
--- a/cpukit/posix/src/mqueue.c
+++ b/cpukit/posix/src/mqueue.c
@@ -49,23 +49,33 @@ void _POSIX_Message_queue_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Message_queue_Information,
- OBJECTS_POSIX_MESSAGE_QUEUES,
- TRUE,
- maximum_message_queues,
+ &_POSIX_Message_queue_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_MESSAGE_QUEUES, /* object class */
+ maximum_message_queues, /* maximum objects of this class */
sizeof( POSIX_Message_queue_Control ),
- TRUE,
- _POSIX_PATH_MAX,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ _POSIX_PATH_MAX /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
_Objects_Initialize_information(
&_POSIX_Message_queue_Information_fds,
+ OBJECTS_POSIX_API,
OBJECTS_POSIX_MESSAGE_QUEUE_FDS,
- FALSE,
maximum_message_queues,
sizeof( POSIX_Message_queue_Control_fd ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/cpukit/posix/src/mqueuecreatesupp.c b/cpukit/posix/src/mqueuecreatesupp.c
index 35b3e1b826..e71e0c6092 100644
--- a/cpukit/posix/src/mqueuecreatesupp.c
+++ b/cpukit/posix/src/mqueuecreatesupp.c
@@ -111,15 +111,9 @@ int _POSIX_Message_queue_Create_support(
if ( ! _CORE_message_queue_Initialize(
&the_mq->Message_queue,
- OBJECTS_POSIX_MESSAGE_QUEUES,
the_mq_attr,
attr.mq_maxmsg,
- attr.mq_msgsize,
-#if 0 && defined(RTEMS_MULTIPROCESSING)
- _POSIX_Message_queue_MP_Send_extract_proxy
-#else
- NULL
-#endif
+ attr.mq_msgsize
) ) {
#if 0 && defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c
index d848c11559..89f9040814 100644
--- a/cpukit/posix/src/mutex.c
+++ b/cpukit/posix/src/mutex.c
@@ -37,13 +37,18 @@ void _POSIX_Mutex_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Mutex_Information,
- OBJECTS_POSIX_MUTEXES,
- TRUE,
- maximum_mutexes,
+ &_POSIX_Mutex_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_MUTEXES, /* object class */
+ maximum_mutexes, /* maximum objects of this class */
sizeof( POSIX_Mutex_Control ),
- FALSE,
- 0,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index 84a0c2b5b7..97882040f9 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -163,10 +163,8 @@ int pthread_mutex_init(
_CORE_mutex_Initialize(
&the_mutex->Mutex,
- OBJECTS_POSIX_MUTEXES,
the_mutex_attr,
- CORE_MUTEX_UNLOCKED,
- NULL /* proxy_extract_callout */
+ CORE_MUTEX_UNLOCKED
);
_Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index 506ef00c6c..f93b6cc7c1 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -225,10 +225,8 @@ void _POSIX_signals_Manager_Initialization(
_Thread_queue_Initialize(
&_POSIX_signals_Wait_queue,
- OBJECTS_NO_CLASS,
THREAD_QUEUE_DISCIPLINE_PRIORITY,
STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
- NULL,
EAGAIN
);
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 9281b5fe11..e1bade3baf 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -167,20 +167,17 @@ boolean _POSIX_Threads_Create_extension(
/* XXX use signal constants */
api->signals_pending = 0;
- if ( _Objects_Get_class( created->Object.id ) == OBJECTS_POSIX_THREADS ) {
+ if ( _Objects_Get_API( created->Object.id ) == OBJECTS_POSIX_API &&
+ _Objects_Get_class( created->Object.id ) == 1 ) {
executing_api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
api->signals_blocked = api->signals_blocked;
} else
api->signals_blocked = 0xffffffff;
-/* XXX set signal parameters -- block all signals for non-posix threads */
-
_Thread_queue_Initialize(
&api->Join_List,
- OBJECTS_NO_CLASS, /* only used for proxy operations */
THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_JOIN_AT_EXIT,
- NULL, /* no extract proxy handler */
0
);
@@ -356,14 +353,19 @@ void _POSIX_Threads_Manager_initialization(
#endif
_Objects_Initialize_information(
- &_POSIX_Threads_Information,
- OBJECTS_POSIX_THREADS,
- FALSE, /* does not support global */
- maximum_pthreads,
+ &_POSIX_Threads_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_THREADS, /* object class */
+ maximum_pthreads, /* maximum objects of this class */
sizeof( Thread_Control ),
- FALSE,
- 0, /* length is arbitrary for now */
- TRUE /* this class is threads */
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ 0 /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
/*
diff --git a/cpukit/posix/src/semaphore.c b/cpukit/posix/src/semaphore.c
index c473dfed4b..e3f6ec9c84 100644
--- a/cpukit/posix/src/semaphore.c
+++ b/cpukit/posix/src/semaphore.c
@@ -37,13 +37,18 @@ void _POSIX_Semaphore_Manager_initialization(
)
{
_Objects_Initialize_information(
- &_POSIX_Semaphore_Information,
- OBJECTS_POSIX_SEMAPHORES,
- TRUE,
- maximum_semaphores,
+ &_POSIX_Semaphore_Information, /* object information table */
+ OBJECTS_POSIX_API, /* object API */
+ OBJECTS_POSIX_SEMAPHORES, /* object class */
+ maximum_semaphores /* maximum objects of this class */,
sizeof( POSIX_Semaphore_Control ),
- TRUE,
- _POSIX_PATH_MAX,
- FALSE
+ /* size of this object's control block */
+ FALSE, /* TRUE if names for this object are strings */
+ _POSIX_PATH_MAX /* maximum length of each object's name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ FALSE, /* TRUE if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
);
}
diff --git a/cpukit/posix/src/semaphorecreatesupp.c b/cpukit/posix/src/semaphorecreatesupp.c
index e45d4d808a..86b1179660 100644
--- a/cpukit/posix/src/semaphorecreatesupp.c
+++ b/cpukit/posix/src/semaphorecreatesupp.c
@@ -100,13 +100,7 @@ int _POSIX_Semaphore_Create_support(
the_sem_attr->maximum_count = 0xFFFFFFFF;
- _CORE_semaphore_Initialize(
- &the_semaphore->Semaphore,
- OBJECTS_POSIX_SEMAPHORES,
- the_sem_attr,
- value,
- NULL /* multiprocessing is not supported */
- );
+ _CORE_semaphore_Initialize( &the_semaphore->Semaphore, the_sem_attr, value );
/*
* Make the semaphore available for use.