From 3507c6df7041f19ec33c6056076520849dd59ac3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 5 Jan 2009 20:26:01 +0000 Subject: 2009-01-05 Joel Sherrill * libcsupport/src/gxx_wrappers.c, posix/include/mqueue.h, posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/key.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, posix/src/condget.c, posix/src/mqueuenametoid.c, posix/src/mutexget.c, posix/src/semaphorenametoid.c, posix/src/semopen.c, sapi/src/itronapi.c, sapi/src/posixapi.c: Make changes necessary for all tests to run on SPARC with 16-bit Ids. This required ensuring that all POSIX and compilering binding code makes a distinction between the public Id type (e.g. pthread_t, etc.) and the RTEMS Object_Id type. All POSIX Object Get routines should not take the POSIX Id type as the argument. Sixteen bit RTEMS Ids should be placed into the 32-bits reserved by the POSIX API type in a uniform manner now. This removed all assumptions that the external Id types in POSIX and ITRON are the same as the internal Object Id type. --- cpukit/posix/src/condget.c | 15 ++++++++------- cpukit/posix/src/mqueuenametoid.c | 7 ++++++- cpukit/posix/src/mutexget.c | 18 +++++++++--------- cpukit/posix/src/semaphorenametoid.c | 9 +++++++-- cpukit/posix/src/semopen.c | 16 ++++++++++------ 5 files changed, 40 insertions(+), 25 deletions(-) (limited to 'cpukit/posix/src') diff --git a/cpukit/posix/src/condget.c b/cpukit/posix/src/condget.c index 03ffebbd09..7a0a8bed85 100644 --- a/cpukit/posix/src/condget.c +++ b/cpukit/posix/src/condget.c @@ -29,20 +29,19 @@ POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get ( Objects_Locations *location ) { - Objects_Id *id = (Objects_Id *)cond; int status; - if ( !id ) { + if ( !cond ) { *location = OBJECTS_ERROR; return (POSIX_Condition_variables_Control *) 0; } - if ( *id == PTHREAD_COND_INITIALIZER ) { + if ( *cond == PTHREAD_COND_INITIALIZER ) { /* * Do an "auto-create" here. */ - status = pthread_cond_init( (pthread_cond_t *)id, 0 ); + status = pthread_cond_init( cond, 0 ); if ( status ) { *location = OBJECTS_ERROR; return (POSIX_Condition_variables_Control *) 0; @@ -52,8 +51,10 @@ POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get ( /* * Now call Objects_Get() */ - - return (POSIX_Condition_variables_Control *) - _Objects_Get( &_POSIX_Condition_variables_Information, *id, location ); + return (POSIX_Condition_variables_Control *)_Objects_Get( + &_POSIX_Condition_variables_Information, + (Objects_Id) *cond, + location + ); } diff --git a/cpukit/posix/src/mqueuenametoid.c b/cpukit/posix/src/mqueuenametoid.c index 06b3964683..fc99638594 100644 --- a/cpukit/posix/src/mqueuenametoid.c +++ b/cpukit/posix/src/mqueuenametoid.c @@ -53,6 +53,7 @@ int _POSIX_Message_queue_Name_to_id( ) { Objects_Name_or_id_lookup_errors status; + Objects_Id the_id; if ( !name ) return EINVAL; @@ -64,7 +65,11 @@ int _POSIX_Message_queue_Name_to_id( return ENAMETOOLONG; status = _Objects_Name_to_id_string( - &_POSIX_Message_queue_Information, name, id ); + &_POSIX_Message_queue_Information, + name, + &the_id + ); + *id = the_id; if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) return 0; diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c index 4a05ddd9a2..5ad33b8c7a 100644 --- a/cpukit/posix/src/mutexget.c +++ b/cpukit/posix/src/mutexget.c @@ -61,12 +61,10 @@ POSIX_Mutex_Control *_POSIX_Mutex_Get ( Objects_Locations *location ) { - Objects_Id *id = (Objects_Id *)mutex; - - ___POSIX_Mutex_Get_support( id, location ); + ___POSIX_Mutex_Get_support( mutex, location ); return (POSIX_Mutex_Control *) - _Objects_Get( &_POSIX_Mutex_Information, *id, location ); + _Objects_Get( &_POSIX_Mutex_Information, (Objects_Id) *mutex, location ); } POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable ( @@ -75,10 +73,12 @@ POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable ( ISR_Level *level ) { - Objects_Id *id = (Objects_Id *)mutex; - - ___POSIX_Mutex_Get_support( id, location ); + ___POSIX_Mutex_Get_support( mutex, location ); - return (POSIX_Mutex_Control *) - _Objects_Get_isr_disable( &_POSIX_Mutex_Information, *id, location, level ); + return (POSIX_Mutex_Control *) _Objects_Get_isr_disable( + &_POSIX_Mutex_Information, + (Objects_Id) *mutex, + location, + level + ); } diff --git a/cpukit/posix/src/semaphorenametoid.c b/cpukit/posix/src/semaphorenametoid.c index 4acee37ce6..e550910653 100644 --- a/cpukit/posix/src/semaphorenametoid.c +++ b/cpukit/posix/src/semaphorenametoid.c @@ -36,11 +36,12 @@ */ int _POSIX_Semaphore_Name_to_id( - const char *name, + const char *name, sem_t *id ) { Objects_Name_or_id_lookup_errors status; + Objects_Id the_id; if ( !name ) return EINVAL; @@ -49,7 +50,11 @@ int _POSIX_Semaphore_Name_to_id( return EINVAL; status = _Objects_Name_to_id_string( - &_POSIX_Semaphore_Information, name, (Objects_Id*)id ); + &_POSIX_Semaphore_Information, + name, + &the_id + ); + *id = the_id; if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL ) return 0; diff --git a/cpukit/posix/src/semopen.c b/cpukit/posix/src/semopen.c index 02b518f588..f3e857e37a 100644 --- a/cpukit/posix/src/semopen.c +++ b/cpukit/posix/src/semopen.c @@ -53,7 +53,7 @@ sem_t *sem_open( unsigned int value = 0; int status; sem_t the_semaphore_id; - Objects_Id *id; + sem_t *id; POSIX_Semaphore_Control *the_semaphore; Objects_Locations location; @@ -101,9 +101,7 @@ sem_t *sem_open( the_semaphore->open_count += 1; _Thread_Enable_dispatch(); _Thread_Enable_dispatch(); - id = &the_semaphore->Object.id; - return (sem_t *)id; - + goto return_id; } /* @@ -127,6 +125,12 @@ sem_t *sem_open( if ( status == -1 ) return SEM_FAILED; - id = &the_semaphore->Object.id; - return (sem_t *)id; +return_id: + #if defined(RTEMS_USE_16_BIT_OBJECT) + the_semaphore->Semaphore_id = the_semaphore->Object.id; + id = &the_semaphore->Semaphore_id; + #else + id = &the_semaphore->Object.id; + #endif + return id; } -- cgit v1.2.3