diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 22:57:43 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 22:57:43 +0000 |
commit | ce19f1fa3bd9f9760f680ef7839ca136a1c2478a (patch) | |
tree | aa2c0b50ec70dd5c9e8d970aaa7c8deba8fcf330 /cpukit/posix/src | |
parent | 2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-ce19f1fa3bd9f9760f680ef7839ca136a1c2478a.tar.bz2 |
2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/include/rtems/itron/object.h, itron/src/cre_tsk.c,
libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c,
libmisc/capture/capture.c, libmisc/monitor/mon-manager.c,
libmisc/stackchk/check.c, posix/src/condinit.c,
posix/src/keycreate.c, posix/src/mqueuecreatesupp.c,
posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c,
posix/src/mqueueopen.c, posix/src/mqueueunlink.c,
posix/src/mutexinit.c, posix/src/pbarrierinit.c,
posix/src/prwlockinit.c, posix/src/pspininit.c,
posix/src/pthreadcreate.c, posix/src/pthreadexit.c,
posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c,
posix/src/timercreate.c, rtems/src/barrierident.c,
rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c,
rtems/src/ratemonident.c, rtems/src/regionident.c,
rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c,
sapi/src/extensionident.c, score/Makefile.am,
score/include/rtems/score/object.h,
score/inline/rtems/score/object.inl, score/src/apimutexallocate.c,
score/src/objectextendinformation.c,
score/src/objectgetnameasstring.c, score/src/objectmp.c,
score/src/objectnametoid.c: Convert the Objects_Name type from a
simple type to a union of an unsigned 32 bit integer and a pointer.
This should help eliminate weird casts between u32 and pointers in
various places. The APIs now have to explicitly call _u32 or _string
versions of helper routines. This should also simplify things and
eliminate the need for ugly casts in some cases.
* score/src/objectclearname.c, score/src/objectcomparenameraw.c,
score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c,
score/src/objectcopynamestring.c: Removed.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r-- | cpukit/posix/src/condinit.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/keycreate.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/mqueuecreatesupp.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/mqueuedeletesupp.c | 8 | ||||
-rw-r--r-- | cpukit/posix/src/mqueuenametoid.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/mqueueopen.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/mqueueunlink.c | 3 | ||||
-rw-r--r-- | cpukit/posix/src/mutexinit.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/pbarrierinit.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/prwlockinit.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/pspininit.c | 6 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadcreate.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadexit.c | 8 | ||||
-rw-r--r-- | cpukit/posix/src/semaphorecreatesupp.c | 6 | ||||
-rw-r--r-- | cpukit/posix/src/semaphorenametoid.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/timercreate.c | 2 |
16 files changed, 35 insertions, 28 deletions
diff --git a/cpukit/posix/src/condinit.c b/cpukit/posix/src/condinit.c index 023e135cb3..5e64efa7cd 100644 --- a/cpukit/posix/src/condinit.c +++ b/cpukit/posix/src/condinit.c @@ -72,7 +72,7 @@ int pthread_cond_init( ETIMEDOUT ); - _Objects_Open( + _Objects_Open_u32( &_POSIX_Condition_variables_Information, &the_cond->Object, 0 diff --git a/cpukit/posix/src/keycreate.c b/cpukit/posix/src/keycreate.c index faf2a75a35..b54a25812a 100644 --- a/cpukit/posix/src/keycreate.c +++ b/cpukit/posix/src/keycreate.c @@ -98,7 +98,7 @@ int pthread_key_create( the_key->is_active = TRUE; - _Objects_Open( &_POSIX_Keys_Information, &the_key->Object, 0 ); + _Objects_Open_u32( &_POSIX_Keys_Information, &the_key->Object, 0 ); *key = the_key->Object.id; diff --git a/cpukit/posix/src/mqueuecreatesupp.c b/cpukit/posix/src/mqueuecreatesupp.c index 2856832718..d6c45f09f4 100644 --- a/cpukit/posix/src/mqueuecreatesupp.c +++ b/cpukit/posix/src/mqueuecreatesupp.c @@ -142,10 +142,10 @@ int _POSIX_Message_queue_Create_support( rtems_set_errno_and_return_minus_one( ENOSPC ); } - _Objects_Open( + _Objects_Open_string( &_POSIX_Message_queue_Information, &the_mq->Object, - (char *) name + name ); *message_queue = the_mq; diff --git a/cpukit/posix/src/mqueuedeletesupp.c b/cpukit/posix/src/mqueuedeletesupp.c index 6d4cd3a908..2aec9c0898 100644 --- a/cpukit/posix/src/mqueuedeletesupp.c +++ b/cpukit/posix/src/mqueuedeletesupp.c @@ -51,10 +51,12 @@ void _POSIX_Message_queue_Delete( { if ( !the_mq->linked && !the_mq->open_count ) { /* the name memory may have been freed by unlink. */ - if ( the_mq->Object.name ) - _Workspace_Free( the_mq->Object.name ); + Objects_Control *the_object = &the_mq->Object; - _Objects_Close( &_POSIX_Message_queue_Information, &the_mq->Object ); + if ( the_object->name.name_p ) + _Workspace_Free( (void *)the_object->name.name_p ); + + _Objects_Close( &_POSIX_Message_queue_Information, the_object ); _CORE_message_queue_Close( &the_mq->Message_queue, diff --git a/cpukit/posix/src/mqueuenametoid.c b/cpukit/posix/src/mqueuenametoid.c index 942c754e36..bc74e7d182 100644 --- a/cpukit/posix/src/mqueuenametoid.c +++ b/cpukit/posix/src/mqueuenametoid.c @@ -63,8 +63,8 @@ int _POSIX_Message_queue_Name_to_id( if( strlen(name) > PATH_MAX ) return ENAMETOOLONG; - status = _Objects_Name_to_id( - &_POSIX_Message_queue_Information, (char *)name, 0, id ); + status = _Objects_Name_to_id_string( + &_POSIX_Message_queue_Information, name, 0, id ); if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) return 0; diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c index e818298bac..1305d3fc65 100644 --- a/cpukit/posix/src/mqueueopen.c +++ b/cpukit/posix/src/mqueueopen.c @@ -119,7 +119,7 @@ mqd_t mq_open( the_mq = _POSIX_Message_queue_Get( the_mq_id, &location ); the_mq->open_count += 1; the_mq_fd->Queue = the_mq; - _Objects_Open( + _Objects_Open_string( &_POSIX_Message_queue_Information_fds, &the_mq_fd->Object, NULL @@ -153,7 +153,7 @@ mqd_t mq_open( } the_mq_fd->Queue = the_mq; - _Objects_Open( + _Objects_Open_string( &_POSIX_Message_queue_Information_fds, &the_mq_fd->Object, NULL diff --git a/cpukit/posix/src/mqueueunlink.c b/cpukit/posix/src/mqueueunlink.c index 7805b1d99a..ff6aec86fe 100644 --- a/cpukit/posix/src/mqueueunlink.c +++ b/cpukit/posix/src/mqueueunlink.c @@ -67,7 +67,8 @@ int mq_unlink( ); the_mq->linked = FALSE; - _Workspace_Free( the_mq->Object.name ); + if ( the_mq->Object.name.name_p ) + _Workspace_Free( (void *)the_mq->Object.name.name_p ); _POSIX_Message_queue_Namespace_remove( the_mq ); _POSIX_Message_queue_Delete( the_mq ); diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c index 1a30740633..da6af07c12 100644 --- a/cpukit/posix/src/mutexinit.c +++ b/cpukit/posix/src/mutexinit.c @@ -159,7 +159,7 @@ int pthread_mutex_init( CORE_MUTEX_UNLOCKED ); - _Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 ); + _Objects_Open_u32( &_POSIX_Mutex_Information, &the_mutex->Object, 0 ); *mutex = the_mutex->Object.id; diff --git a/cpukit/posix/src/pbarrierinit.c b/cpukit/posix/src/pbarrierinit.c index 816e695504..a2a77f83a5 100644 --- a/cpukit/posix/src/pbarrierinit.c +++ b/cpukit/posix/src/pbarrierinit.c @@ -101,7 +101,7 @@ int pthread_barrier_init( _CORE_barrier_Initialize( &the_barrier->Barrier, &the_attributes ); - _Objects_Open( + _Objects_Open_u32( &_POSIX_Barrier_Information, &the_barrier->Object, 0 diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c index 7149a68e09..e769a9b031 100644 --- a/cpukit/posix/src/prwlockinit.c +++ b/cpukit/posix/src/prwlockinit.c @@ -95,7 +95,7 @@ int pthread_rwlock_init( _CORE_RWLock_Initialize( &the_rwlock->RWLock, &the_attributes ); - _Objects_Open( + _Objects_Open_u32( &_POSIX_RWLock_Information, &the_rwlock->Object, 0 diff --git a/cpukit/posix/src/pspininit.c b/cpukit/posix/src/pspininit.c index d7eb39a485..6a0f707609 100644 --- a/cpukit/posix/src/pspininit.c +++ b/cpukit/posix/src/pspininit.c @@ -67,11 +67,7 @@ int pthread_spin_init( _CORE_spinlock_Initialize( &the_spinlock->Spinlock, &attributes ); - _Objects_Open( - &_POSIX_Spinlock_Information, - &the_spinlock->Object, - 0 - ); + _Objects_Open_u32( &_POSIX_Spinlock_Information, &the_spinlock->Object, 0 ); *spinlock = the_spinlock->Object.id; diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index e5aff1ea78..c239036e1b 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -42,6 +42,7 @@ int pthread_create( POSIX_API_Control *api; int schedpolicy = SCHED_RR; struct sched_param schedparam; + Objects_Name name; the_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes; @@ -175,6 +176,7 @@ int pthread_create( * Initialize the core thread for this task. */ + name.name_p = NULL; /* posix threads don't have a name by default */ status = _Thread_Initialize( &_POSIX_Threads_Information, the_thread, @@ -186,7 +188,7 @@ int pthread_create( budget_algorithm, budget_callout, 0, /* isr level */ - NULL /* posix threads don't have a name */ + name /* posix threads don't have a name */ ); if ( !status ) { diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c index 8346f139b8..ef3b3302bd 100644 --- a/cpukit/posix/src/pthreadexit.c +++ b/cpukit/posix/src/pthreadexit.c @@ -33,9 +33,11 @@ void pthread_exit( the_information = _Objects_Get_information( _Thread_Executing->Object.id ); - /* This should never happen if _Thread_Get() works right */ - assert( the_information ); - + /* + * the_information has to be non-NULL. Otherwise, we couldn't be + * running in a thread of this API and class. + */ + _Thread_Disable_dispatch(); _Thread_Executing->Wait.return_argument = value_ptr; diff --git a/cpukit/posix/src/semaphorecreatesupp.c b/cpukit/posix/src/semaphorecreatesupp.c index fb87f0f8a6..0ee09f5fa6 100644 --- a/cpukit/posix/src/semaphorecreatesupp.c +++ b/cpukit/posix/src/semaphorecreatesupp.c @@ -106,7 +106,11 @@ int _POSIX_Semaphore_Create_support( * Make the semaphore available for use. */ - _Objects_Open(&_POSIX_Semaphore_Information, &the_semaphore->Object, name_p); + _Objects_Open_string( + &_POSIX_Semaphore_Information, + &the_semaphore->Object, + name_p + ); *the_sem = the_semaphore; diff --git a/cpukit/posix/src/semaphorenametoid.c b/cpukit/posix/src/semaphorenametoid.c index 2051cb07ca..071745c3d5 100644 --- a/cpukit/posix/src/semaphorenametoid.c +++ b/cpukit/posix/src/semaphorenametoid.c @@ -48,8 +48,8 @@ int _POSIX_Semaphore_Name_to_id( if ( !name[0] ) return EINVAL; - status = _Objects_Name_to_id( - &_POSIX_Semaphore_Information, (char *)name, 0, (Objects_Id*)id ); + status = _Objects_Name_to_id_string( + &_POSIX_Semaphore_Information, name, 0, (Objects_Id*)id ); if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) return 0; diff --git a/cpukit/posix/src/timercreate.c b/cpukit/posix/src/timercreate.c index 90cb9b0f8b..da4fe3641c 100644 --- a/cpukit/posix/src/timercreate.c +++ b/cpukit/posix/src/timercreate.c @@ -89,7 +89,7 @@ int timer_create( ptimer->timer_data.it_interval.tv_nsec = 0; _Watchdog_Initialize( &ptimer->Timer, NULL, 0, NULL ); - _Objects_Open(&_POSIX_Timer_Information, &ptimer->Object, (Objects_Name) 0); + _Objects_Open_u32(&_POSIX_Timer_Information, &ptimer->Object, 0); *timerid = ptimer->Object.id; _Thread_Enable_dispatch(); |