diff options
Diffstat (limited to 'c/src/exec/posix')
-rw-r--r-- | c/src/exec/posix/headers/Makefile.in | 10 | ||||
-rw-r--r-- | c/src/exec/posix/headers/cond.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/headers/mqueue.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/headers/mutex.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/headers/pthread.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/headers/semaphore.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/include/rtems/posix/Makefile.in | 10 | ||||
-rw-r--r-- | c/src/exec/posix/include/rtems/posix/cond.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/include/rtems/posix/mqueue.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/include/rtems/posix/mutex.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/include/rtems/posix/pthread.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/include/rtems/posix/semaphore.h | 2 | ||||
-rw-r--r-- | c/src/exec/posix/src/cond.c | 35 | ||||
-rw-r--r-- | c/src/exec/posix/src/mutex.c | 56 |
14 files changed, 108 insertions, 23 deletions
diff --git a/c/src/exec/posix/headers/Makefile.in b/c/src/exec/posix/headers/Makefile.in index 543917d7ed..3c75974208 100644 --- a/c/src/exec/posix/headers/Makefile.in +++ b/c/src/exec/posix/headers/Makefile.in @@ -8,9 +8,13 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -H_PIECES= cond condmp config key mutex mutexmp posixapi \ - priority psignal pthread pthreadmp seterr threadsup time -#H_PIECES= cancel cond condmp intr key mqueue mqueuemp mutex \ +# We only build multiprocessing related files if HAS_MP was defined +MP_PIECES_yes_V = condmp mutexmp pthreadmp +MP_PIECES = $(MP_PIECES_$(HAS_MP)_V) + +H_PIECES= cond config key mutex posixapi \ + priority psignal pthread seterr threadsup time +#H_PIECES= cancel cond intr key mqueue mqueuemp mutex \ # mutexmp pthread pthreadmp priority semaphore semaphoremp threadsup \ # time H_FILES=$(H_PIECES:%=$(srcdir)/%.h) diff --git a/c/src/exec/posix/headers/cond.h b/c/src/exec/posix/headers/cond.h index 92c2e453ae..0fb44d8042 100644 --- a/c/src/exec/posix/headers/cond.h +++ b/c/src/exec/posix/headers/cond.h @@ -119,7 +119,9 @@ RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null ( ); #include <rtems/posix/cond.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/condmp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/headers/mqueue.h b/c/src/exec/posix/headers/mqueue.h index 8e2851bfb5..f73cb509ce 100644 --- a/c/src/exec/posix/headers/mqueue.h +++ b/c/src/exec/posix/headers/mqueue.h @@ -175,7 +175,9 @@ RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Message_queue_Priority_to_core( ); #include <rtems/posix/mqueue.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/mqueuemp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/headers/mutex.h b/c/src/exec/posix/headers/mutex.h index e6c5c44d39..b0d9526dd5 100644 --- a/c/src/exec/posix/headers/mutex.h +++ b/c/src/exec/posix/headers/mutex.h @@ -109,7 +109,9 @@ RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null ( ); #include <rtems/posix/mutex.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/mutexmp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/headers/pthread.h b/c/src/exec/posix/headers/pthread.h index abf5933fc2..46e5834385 100644 --- a/c/src/exec/posix/headers/pthread.h +++ b/c/src/exec/posix/headers/pthread.h @@ -112,7 +112,9 @@ RTEMS_INLINE_ROUTINE boolean _POSIX_Threads_Is_null( ); #include <rtems/posix/pthread.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/pthreadmp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/headers/semaphore.h b/c/src/exec/posix/headers/semaphore.h index cc658ee32b..aaf0c4b898 100644 --- a/c/src/exec/posix/headers/semaphore.h +++ b/c/src/exec/posix/headers/semaphore.h @@ -124,7 +124,9 @@ int _POSIX_Semaphore_Name_to_id( ); #include <rtems/posix/semaphore.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/semaphoremp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/include/rtems/posix/Makefile.in b/c/src/exec/posix/include/rtems/posix/Makefile.in index 543917d7ed..3c75974208 100644 --- a/c/src/exec/posix/include/rtems/posix/Makefile.in +++ b/c/src/exec/posix/include/rtems/posix/Makefile.in @@ -8,9 +8,13 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -H_PIECES= cond condmp config key mutex mutexmp posixapi \ - priority psignal pthread pthreadmp seterr threadsup time -#H_PIECES= cancel cond condmp intr key mqueue mqueuemp mutex \ +# We only build multiprocessing related files if HAS_MP was defined +MP_PIECES_yes_V = condmp mutexmp pthreadmp +MP_PIECES = $(MP_PIECES_$(HAS_MP)_V) + +H_PIECES= cond config key mutex posixapi \ + priority psignal pthread seterr threadsup time +#H_PIECES= cancel cond intr key mqueue mqueuemp mutex \ # mutexmp pthread pthreadmp priority semaphore semaphoremp threadsup \ # time H_FILES=$(H_PIECES:%=$(srcdir)/%.h) diff --git a/c/src/exec/posix/include/rtems/posix/cond.h b/c/src/exec/posix/include/rtems/posix/cond.h index 92c2e453ae..0fb44d8042 100644 --- a/c/src/exec/posix/include/rtems/posix/cond.h +++ b/c/src/exec/posix/include/rtems/posix/cond.h @@ -119,7 +119,9 @@ RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null ( ); #include <rtems/posix/cond.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/condmp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/include/rtems/posix/mqueue.h b/c/src/exec/posix/include/rtems/posix/mqueue.h index 8e2851bfb5..f73cb509ce 100644 --- a/c/src/exec/posix/include/rtems/posix/mqueue.h +++ b/c/src/exec/posix/include/rtems/posix/mqueue.h @@ -175,7 +175,9 @@ RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Message_queue_Priority_to_core( ); #include <rtems/posix/mqueue.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/mqueuemp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/include/rtems/posix/mutex.h b/c/src/exec/posix/include/rtems/posix/mutex.h index e6c5c44d39..b0d9526dd5 100644 --- a/c/src/exec/posix/include/rtems/posix/mutex.h +++ b/c/src/exec/posix/include/rtems/posix/mutex.h @@ -109,7 +109,9 @@ RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null ( ); #include <rtems/posix/mutex.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/mutexmp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/include/rtems/posix/pthread.h b/c/src/exec/posix/include/rtems/posix/pthread.h index abf5933fc2..46e5834385 100644 --- a/c/src/exec/posix/include/rtems/posix/pthread.h +++ b/c/src/exec/posix/include/rtems/posix/pthread.h @@ -112,7 +112,9 @@ RTEMS_INLINE_ROUTINE boolean _POSIX_Threads_Is_null( ); #include <rtems/posix/pthread.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/pthreadmp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/include/rtems/posix/semaphore.h b/c/src/exec/posix/include/rtems/posix/semaphore.h index cc658ee32b..aaf0c4b898 100644 --- a/c/src/exec/posix/include/rtems/posix/semaphore.h +++ b/c/src/exec/posix/include/rtems/posix/semaphore.h @@ -124,7 +124,9 @@ int _POSIX_Semaphore_Name_to_id( ); #include <rtems/posix/semaphore.inl> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/posix/semaphoremp.h> +#endif #ifdef __cplusplus } diff --git a/c/src/exec/posix/src/cond.c b/c/src/exec/posix/src/cond.c index 248f836b94..0cb06ec192 100644 --- a/c/src/exec/posix/src/cond.c +++ b/c/src/exec/posix/src/cond.c @@ -17,6 +17,8 @@ * TEMPORARY */ + +#if defined(RTEMS_MULTIPROCESSING) void _POSIX_Condition_variables_MP_Send_process_packet ( POSIX_Condition_variables_MP_Remote_operations operation, Objects_Id condition_variables_id, @@ -33,6 +35,7 @@ void _POSIX_Condition_variables_MP_Send_extract_proxy( { (void) POSIX_MP_NOT_IMPLEMENTED(); } +#endif /* * END OF TEMPORARY @@ -190,6 +193,7 @@ int pthread_cond_init( return ENOMEM; } +#if defined(RTEMS_MULTIPROCESSING) if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED && !( _Objects_MP_Allocate_and_open( &_POSIX_Condition_variables_Information, 0, the_cond->Object.id, FALSE ) ) ) { @@ -197,6 +201,7 @@ int pthread_cond_init( _Thread_Enable_dispatch(); return EAGAIN; } +#endif the_cond->process_shared = the_attr->process_shared; @@ -208,7 +213,11 @@ int pthread_cond_init( 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 ); @@ -220,6 +229,7 @@ int pthread_cond_init( *cond = the_cond->Object.id; +#if defined(RTEMS_MULTIPROCESSING) if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED ) _POSIX_Condition_variables_MP_Send_process_packet( POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE, @@ -227,6 +237,7 @@ int pthread_cond_init( 0, /* Name not used */ 0 /* Not used */ ); +#endif _Thread_Enable_dispatch(); @@ -248,12 +259,17 @@ int pthread_cond_destroy( the_cond = _POSIX_Condition_variables_Get( cond, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return POSIX_MP_NOT_IMPLEMENTED(); return EINVAL; +#endif + + case OBJECTS_ERROR: + return EINVAL; + + case OBJECTS_LOCAL: if ( _Thread_queue_First( &the_cond->Wait_queue ) ) { @@ -268,6 +284,7 @@ int pthread_cond_destroy( _POSIX_Condition_variables_Free( the_cond ); +#if defined(RTEMS_MULTIPROCESSING) if ( the_cond->process_shared == PTHREAD_PROCESS_SHARED ) { _Objects_MP_Close( @@ -282,6 +299,7 @@ int pthread_cond_destroy( 0 /* Not used */ ); } +#endif _Thread_Enable_dispatch(); return 0; } @@ -307,12 +325,15 @@ int _POSIX_Condition_variables_Signal_support( the_cond = _POSIX_Condition_variables_Get( cond, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return POSIX_MP_NOT_IMPLEMENTED(); return EINVAL; +#endif + + case OBJECTS_ERROR: + return EINVAL; case OBJECTS_LOCAL: do { @@ -380,12 +401,14 @@ int _POSIX_Condition_variables_Wait_support( the_cond = _POSIX_Condition_variables_Get( cond, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return POSIX_MP_NOT_IMPLEMENTED(); return EINVAL; +#endif + case OBJECTS_ERROR: + return EINVAL; case OBJECTS_LOCAL: if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) ) { diff --git a/c/src/exec/posix/src/mutex.c b/c/src/exec/posix/src/mutex.c index fa2ccc9cc5..10a38a06e5 100644 --- a/c/src/exec/posix/src/mutex.c +++ b/c/src/exec/posix/src/mutex.c @@ -9,7 +9,9 @@ #include <rtems/system.h> #include <rtems/score/coremutex.h> #include <rtems/score/watchdog.h> +#if defined(RTEMS_MULTIPROCESSING) #include <rtems/score/mpci.h> +#endif #include <rtems/posix/mutex.h> #include <rtems/posix/priority.h> #include <rtems/posix/time.h> @@ -18,6 +20,7 @@ * TEMPORARY */ +#if defined(RTEMS_MULTIPROCESSING) void _POSIX_Mutex_MP_Send_process_packet ( POSIX_Mutex_MP_Remote_operations operation, Objects_Id mutex_id, @@ -52,6 +55,7 @@ void POSIX_Threads_mutex_MP_support( { (void) POSIX_MP_NOT_IMPLEMENTED(); /* XXX: should never get here */ } +#endif /* * END OF TEMPORARY @@ -238,9 +242,9 @@ int pthread_mutex_init( mutex_in_use = _POSIX_Mutex_Get( mutex, &location ); switch ( location ) { + case OBJECTS_REMOTE: case OBJECTS_ERROR: break; - case OBJECTS_REMOTE: case OBJECTS_LOCAL: _Thread_Enable_dispatch(); return EBUSY; @@ -256,8 +260,10 @@ int pthread_mutex_init( assert( the_attr->process_shared == PTHREAD_PROCESS_PRIVATE ); +#if defined(RTEMS_MULTIPROCESSING) if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED ) return POSIX_MP_NOT_IMPLEMENTED(); +#endif /* * Determine the discipline of the mutex @@ -289,6 +295,7 @@ int pthread_mutex_init( return EAGAIN; } +#if defined(RTEMS_MULTIPROCESSING) if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED && !( _Objects_MP_Allocate_and_open( &_POSIX_Mutex_Information, 0, the_mutex->Object.id, FALSE ) ) ) { @@ -296,6 +303,7 @@ int pthread_mutex_init( _Thread_Enable_dispatch(); return EAGAIN; } +#endif the_mutex->process_shared = the_attr->process_shared; @@ -322,6 +330,7 @@ int pthread_mutex_init( *mutex = the_mutex->Object.id; +#if defined(RTEMS_MULTIPROCESSING) if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED ) _POSIX_Mutex_MP_Send_process_packet( POSIX_MUTEX_MP_ANNOUNCE_CREATE, @@ -329,6 +338,7 @@ int pthread_mutex_init( 0, /* Name not used */ 0 /* Not used */ ); +#endif _Thread_Enable_dispatch(); return 0; @@ -348,12 +358,14 @@ int pthread_mutex_destroy( the_mutex = _POSIX_Mutex_Get( mutex, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return POSIX_MP_NOT_IMPLEMENTED(); return EINVAL; +#endif + case OBJECTS_ERROR: + return EINVAL; case OBJECTS_LOCAL: /* * XXX: There is an error for the mutex being locked @@ -369,12 +381,17 @@ int pthread_mutex_destroy( _CORE_mutex_Flush( &the_mutex->Mutex, +#if defined(RTEMS_MULTIPROCESSING) _POSIX_Mutex_MP_Send_object_was_deleted, +#else + NULL, +#endif EINVAL ); _POSIX_Mutex_Free( the_mutex ); +#if defined(RTEMS_MULTIPROCESSING) if ( the_mutex->process_shared == PTHREAD_PROCESS_SHARED ) { _Objects_MP_Close( &_POSIX_Mutex_Information, the_mutex->Object.id ); @@ -386,6 +403,7 @@ int pthread_mutex_destroy( 0 /* Not used */ ); } +#endif _Thread_Enable_dispatch(); return 0; } @@ -411,15 +429,17 @@ int _POSIX_Mutex_Lock_support( the_mutex = _POSIX_Mutex_Get( mutex, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _POSIX_Mutex_MP_Send_request_packet( POSIX_MUTEX_MP_OBTAIN_REQUEST, *mutex, 0, /* must define the option set */ WATCHDOG_NO_TIMEOUT ); +#endif + case OBJECTS_ERROR: + return EINVAL; case OBJECTS_LOCAL: _CORE_mutex_Seize( &the_mutex->Mutex, @@ -480,20 +500,26 @@ int pthread_mutex_unlock( the_mutex = _POSIX_Mutex_Get( mutex, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _POSIX_Mutex_MP_Send_request_packet( POSIX_MUTEX_MP_RELEASE_REQUEST, *mutex, 0, /* Not used */ MPCI_DEFAULT_TIMEOUT ); +#endif + case OBJECTS_ERROR: + return EINVAL; case OBJECTS_LOCAL: status = _CORE_mutex_Surrender( &the_mutex->Mutex, the_mutex->Object.id, +#if defined(RTEMS_MULTIPROCESSING) POSIX_Threads_mutex_MP_support +#else + NULL +#endif ); _Thread_Enable_dispatch(); return _POSIX_Mutex_From_core_mutex_status( status ); @@ -634,11 +660,13 @@ int pthread_mutex_setprioceiling( the_mutex = _POSIX_Mutex_Get( mutex, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; /* impossible to get here */ case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) /* XXX It feels questionable to set the ceiling on a remote mutex. */ return EINVAL; +#endif + case OBJECTS_ERROR: + return EINVAL; /* impossible to get here */ case OBJECTS_LOCAL: *old_ceiling = _POSIX_Priority_From_core( the_mutex->Mutex.Attributes.priority_ceiling @@ -647,7 +675,11 @@ int pthread_mutex_setprioceiling( _CORE_mutex_Surrender( &the_mutex->Mutex, the_mutex->Object.id, +#if defined(RTEMS_MULTIPROCESSING) POSIX_Threads_mutex_MP_support +#else + NULL +#endif ); _Thread_Enable_dispatch(); return 0; @@ -673,10 +705,12 @@ int pthread_mutex_getprioceiling( the_mutex = _POSIX_Mutex_Get( mutex, &location ); switch ( location ) { - case OBJECTS_ERROR: - return EINVAL; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */ +#endif + case OBJECTS_ERROR: + return EINVAL; case OBJECTS_LOCAL: *prioceiling = _POSIX_Priority_From_core( the_mutex->Mutex.Attributes.priority_ceiling |