[PATCH 10/14] posix: Provide threads by default
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Oct 29 09:03:19 UTC 2018
Update #2514.
---
cpukit/Makefile.am | 14 +--
cpukit/include/rtems/confdefs.h | 123 ++++++++++++--------------
cpukit/include/rtems/monitor.h | 4 +-
cpukit/include/rtems/posix/pthreadattrimpl.h | 2 -
cpukit/include/rtems/score/thread.h | 10 +--
cpukit/libcsupport/src/resource_snapshot.c | 30 +------
cpukit/libmisc/monitor/mon-monitor.c | 4 -
cpukit/libmisc/monitor/mon-object.c | 8 +-
cpukit/posix/src/psxtransschedparam.c | 6 +-
cpukit/posix/src/pthread.c | 10 ++-
cpukit/posix/src/pthreadcreate.c | 14 +--
cpukit/posix/src/pthreadsetschedparam.c | 16 +++-
cpukit/rtems/src/rtemsobjectgetapiclassname.c | 2 +-
cpukit/score/src/threaditerate.c | 2 -
cpukit/score/src/threadrestart.c | 16 ----
cpukit/score/src/wkspace.c | 2 -
16 files changed, 106 insertions(+), 157 deletions(-)
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index a8f78ead9c..b0d9088d44 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -470,6 +470,7 @@ librtemscpu_a_SOURCES += libmd/md5.c
librtemscpu_a_SOURCES += libstdthreads/call_once.c
librtemscpu_a_SOURCES += libstdthreads/cnd.c
librtemscpu_a_SOURCES += libstdthreads/mtx.c
+librtemscpu_a_SOURCES += libstdthreads/thrd.c
librtemscpu_a_SOURCES += libstdthreads/tss.c
librtemscpu_a_SOURCES += posix/src/adjtime.c
librtemscpu_a_SOURCES += posix/src/aio_suspend.c
@@ -596,8 +597,10 @@ librtemscpu_a_SOURCES += posix/src/pthreadattrsetscope.c
librtemscpu_a_SOURCES += posix/src/pthreadattrsetstackaddr.c
librtemscpu_a_SOURCES += posix/src/pthreadattrsetstack.c
librtemscpu_a_SOURCES += posix/src/pthreadattrsetstacksize.c
+librtemscpu_a_SOURCES += posix/src/pthread.c
librtemscpu_a_SOURCES += posix/src/pthreadconcurrency.c
librtemscpu_a_SOURCES += posix/src/pthreadconfig.c
+librtemscpu_a_SOURCES += posix/src/pthreadcreate.c
librtemscpu_a_SOURCES += posix/src/pthreaddetach.c
librtemscpu_a_SOURCES += posix/src/pthreadequal.c
librtemscpu_a_SOURCES += posix/src/pthreadexit.c
@@ -606,10 +609,14 @@ librtemscpu_a_SOURCES += posix/src/pthreadgetattrnp.c
librtemscpu_a_SOURCES += posix/src/pthreadgetcpuclockid.c
librtemscpu_a_SOURCES += posix/src/pthreadgetnamenp.c
librtemscpu_a_SOURCES += posix/src/pthreadgetschedparam.c
+librtemscpu_a_SOURCES += posix/src/pthreadinitthreads.c
+librtemscpu_a_SOURCES += posix/src/pthreadjoin.c
librtemscpu_a_SOURCES += posix/src/pthreadonce.c
librtemscpu_a_SOURCES += posix/src/pthreadself.c
librtemscpu_a_SOURCES += posix/src/pthreadsetaffinitynp.c
librtemscpu_a_SOURCES += posix/src/pthreadsetnamenp.c
+librtemscpu_a_SOURCES += posix/src/pthreadsetschedparam.c
+librtemscpu_a_SOURCES += posix/src/pthreadsetschedprio.c
librtemscpu_a_SOURCES += posix/src/rwlockattrdestroy.c
librtemscpu_a_SOURCES += posix/src/rwlockattrgetpshared.c
librtemscpu_a_SOURCES += posix/src/rwlockattrinit.c
@@ -1047,7 +1054,6 @@ endif
if HAS_PTHREADS
-librtemscpu_a_SOURCES += libstdthreads/thrd.c
librtemscpu_a_SOURCES += posix/src/aio_cancel.c
librtemscpu_a_SOURCES += posix/src/aio_error.c
librtemscpu_a_SOURCES += posix/src/aio_fsync.c
@@ -1070,13 +1076,7 @@ librtemscpu_a_SOURCES += posix/src/psignalunblockthread.c
librtemscpu_a_SOURCES += posix/src/psxpriorityisvalid.c
librtemscpu_a_SOURCES += posix/src/psxtimercreate.c
librtemscpu_a_SOURCES += posix/src/psxtimerdelete.c
-librtemscpu_a_SOURCES += posix/src/pthread.c
-librtemscpu_a_SOURCES += posix/src/pthreadcreate.c
-librtemscpu_a_SOURCES += posix/src/pthreadinitthreads.c
-librtemscpu_a_SOURCES += posix/src/pthreadjoin.c
librtemscpu_a_SOURCES += posix/src/pthreadkill.c
-librtemscpu_a_SOURCES += posix/src/pthreadsetschedparam.c
-librtemscpu_a_SOURCES += posix/src/pthreadsetschedprio.c
librtemscpu_a_SOURCES += posix/src/pthreadsigmask.c
librtemscpu_a_SOURCES += posix/src/ptimer.c
librtemscpu_a_SOURCES += posix/src/setitimer.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index c2c6fe6507..64577b92d7 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -34,6 +34,7 @@
#include <rtems/score/wkspace.h>
#include <rtems/posix/key.h>
#include <rtems/posix/mqueue.h>
+#include <rtems/posix/pthread.h>
#include <rtems/posix/semaphore.h>
#include <rtems/posix/shm.h>
@@ -1950,12 +1951,12 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#define CONFIGURE_MAXIMUM_POSIX_SHMS \
rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
#endif
+ #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
+ #define CONFIGURE_MAXIMUM_POSIX_THREADS \
+ rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
+ #endif
#ifdef RTEMS_POSIX_API
- #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
- #define CONFIGURE_MAXIMUM_POSIX_THREADS \
- rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
- #endif
#if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS)
#define CONFIGURE_MAXIMUM_POSIX_TIMERS \
rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
@@ -2300,6 +2301,14 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
_Configure_Max_Objects(_key_value_pairs) \
* sizeof(POSIX_Keys_Key_value_pair)))
+/**
+ * This configuration parameter specifies the maximum number of
+ * POSIX API threads.
+ */
+#ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
+ #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
+#endif
+
/*
* Account for the object control structures plus the name
* of the object to be duplicated.
@@ -2363,18 +2372,9 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#include <sys/types.h>
#include <signal.h>
#include <rtems/posix/psignal.h>
- #include <rtems/posix/pthread.h>
#include <rtems/posix/threadsup.h>
#include <rtems/posix/timer.h>
- /**
- * This configuration parameter specifies the maximum number of
- * POSIX API threads.
- */
- #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
- #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
- #endif
-
/**
* This configuration parameter specifies the maximum number of
* POSIX API timers.
@@ -2405,42 +2405,36 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
_Configure_From_workspace( \
(_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
+#endif /* RTEMS_POSIX_API */
- #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
- #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
- #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
- #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init
- #endif
+#ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
+ #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
+ #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
+ #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init
+ #endif
- #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
- #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
- CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
- #endif
+ #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+ #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+ CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
+ #endif
- #ifdef CONFIGURE_INIT
- posix_initialization_threads_table POSIX_Initialization_threads[] = {
- { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
- CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
- };
- #endif
+ #ifdef CONFIGURE_INIT
+ posix_initialization_threads_table POSIX_Initialization_threads[] = {
+ { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
+ CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
+ };
+ #endif
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
- POSIX_Initialization_threads
+ #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
+ POSIX_Initialization_threads
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
- RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
- #endif /* !CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
- #else /* !CONFIGURE_POSIX_INIT_THREAD_TABLE */
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
- #endif /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
-#else
- /**
- * This configuration parameter specifies the maximum number of
- * POSIX API threads.
- */
- #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
-#endif /* RTEMS_POSIX_API */
+ #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
+ RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
+ #endif /* !CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
+#else /* !CONFIGURE_POSIX_INIT_THREAD_TABLE */
+ #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
+ #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
+#endif /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
/**
* This configuration parameter specifies the stack size of the
@@ -2736,8 +2730,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
* This accounts for any extra memory required by the POSIX API
* Initialization Thread.
*/
-#if defined(RTEMS_POSIX_API) && \
- (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
+#if (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \
CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE)
#define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \
(CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \
@@ -2999,13 +2992,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
const uint32_t _Configuration_POSIX_Maximum_timers =
CONFIGURE_MAXIMUM_POSIX_TIMERS;
#endif
-
- posix_initialization_threads_table * const
- _Configuration_POSIX_Initialization_threads =
- CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME;
-
- const size_t _Configuration_POSIX_Initialization_thread_count =
- CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE;
#endif
const size_t _Configuration_POSIX_Minimum_stack_size =
@@ -3098,16 +3084,21 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
* If the user has configured a set of POSIX Initialization Threads,
* then we need to install the code that runs that loop.
*/
-#ifdef RTEMS_POSIX_API
- #ifdef CONFIGURE_INIT
- #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
- defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
- RTEMS_SYSINIT_ITEM(
- _POSIX_Threads_Initialize_user_threads_body,
- RTEMS_SYSINIT_POSIX_USER_THREADS,
- RTEMS_SYSINIT_ORDER_MIDDLE
- );
- #endif
+#ifdef CONFIGURE_INIT
+ #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
+ defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
+ posix_initialization_threads_table * const
+ _Configuration_POSIX_Initialization_threads =
+ CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME;
+
+ const size_t _Configuration_POSIX_Initialization_thread_count =
+ CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE;
+
+ RTEMS_SYSINIT_ITEM(
+ _POSIX_Threads_Initialize_user_threads_body,
+ RTEMS_SYSINIT_POSIX_USER_THREADS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+ );
#endif
#endif
@@ -3323,10 +3314,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
* CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS are not in this list.
*/
#if !defined(RTEMS_POSIX_API)
- #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
- (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
- (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
- defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
+ #if ((CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
+ (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0))
#error "CONFIGURATION ERROR: POSIX API support not configured!!"
#endif
#endif
diff --git a/cpukit/include/rtems/monitor.h b/cpukit/include/rtems/monitor.h
index 6ecd903c63..d973687396 100644
--- a/cpukit/include/rtems/monitor.h
+++ b/cpukit/include/rtems/monitor.h
@@ -43,9 +43,7 @@ typedef enum {
RTEMS_MONITOR_OBJECT_INIT_TASK,
RTEMS_MONITOR_OBJECT_MPCI,
RTEMS_MONITOR_OBJECT_SYMBOL,
- #if defined(RTEMS_POSIX_API)
- RTEMS_MONITOR_OBJECT_PTHREAD,
- #endif
+ RTEMS_MONITOR_OBJECT_PTHREAD
} rtems_monitor_object_type_t;
/*
diff --git a/cpukit/include/rtems/posix/pthreadattrimpl.h b/cpukit/include/rtems/posix/pthreadattrimpl.h
index cd4b3528a2..b5e02ec1c7 100644
--- a/cpukit/include/rtems/posix/pthreadattrimpl.h
+++ b/cpukit/include/rtems/posix/pthreadattrimpl.h
@@ -25,9 +25,7 @@
#include <rtems/score/basedefs.h>
#include <rtems/score/assert.h>
#include <rtems/posix/priorityimpl.h>
-#if defined(RTEMS_POSIX_API)
#include <rtems/posix/threadsup.h>
-#endif
#ifdef __cplusplus
extern "C" {
diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h
index 1e97083dd7..c665fccb69 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -69,9 +69,7 @@ extern "C" {
*/
/**@{*/
-#if defined(RTEMS_POSIX_API)
- #define RTEMS_SCORE_THREAD_ENABLE_EXHAUST_TIMESLICE
-#endif
+#define RTEMS_SCORE_THREAD_ENABLE_EXHAUST_TIMESLICE
/*
* With the addition of the Constant Block Scheduler (CBS),
@@ -79,9 +77,7 @@ extern "C" {
*/
#define RTEMS_SCORE_THREAD_ENABLE_SCHEDULER_CALLOUT
-#if defined(RTEMS_POSIX_API)
- #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
-#endif
+#define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
#if defined(RTEMS_DEBUG)
#define RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT
@@ -703,7 +699,6 @@ typedef struct {
*/
uint32_t pending_life_change_requests;
-#if defined(RTEMS_POSIX_API)
/**
* @brief The thread exit value.
*
@@ -713,7 +708,6 @@ typedef struct {
* - NULL.
*/
void *exit_value;
-#endif
} Thread_Life_control;
typedef struct {
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c
index caa3d3ebb3..86f7d28188 100644
--- a/cpukit/libcsupport/src/resource_snapshot.c
+++ b/cpukit/libcsupport/src/resource_snapshot.c
@@ -26,30 +26,8 @@
#include <rtems/score/protectedheap.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/wkspace.h>
-
#include <rtems/posix/keyimpl.h>
-#include <rtems/rtems/barrierimpl.h>
-#include <rtems/extensionimpl.h>
-#include <rtems/rtems/dpmemimpl.h>
-#include <rtems/rtems/messageimpl.h>
-#include <rtems/rtems/partimpl.h>
-#include <rtems/rtems/ratemonimpl.h>
-#include <rtems/rtems/regionimpl.h>
-#include <rtems/rtems/semimpl.h>
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/rtems/timerimpl.h>
-
-#ifdef RTEMS_POSIX_API
- #include <rtems/posix/barrierimpl.h>
- #include <rtems/posix/mqueueimpl.h>
- #include <rtems/posix/muteximpl.h>
- #include <rtems/posix/psignal.h>
- #include <rtems/posix/pthreadimpl.h>
- #include <rtems/posix/semaphoreimpl.h>
- #include <rtems/posix/timerimpl.h>
-#endif
-
static const struct {
Objects_APIs api;
uint16_t cls;
@@ -64,12 +42,12 @@ static const struct {
{ OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS },
{ OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES },
{ OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS },
- { OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS }
+ { OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS },
+ { OBJECTS_POSIX_API, OBJECTS_POSIX_MESSAGE_QUEUES },
+ { OBJECTS_POSIX_API, OBJECTS_POSIX_SEMAPHORES },
+ { OBJECTS_POSIX_API, OBJECTS_POSIX_THREADS }
#ifdef RTEMS_POSIX_API
,
- { OBJECTS_POSIX_API, OBJECTS_POSIX_MESSAGE_QUEUES },
- { OBJECTS_POSIX_API, OBJECTS_POSIX_SEMAPHORES },
- { OBJECTS_POSIX_API, OBJECTS_POSIX_THREADS },
{ OBJECTS_POSIX_API, OBJECTS_POSIX_TIMERS }
#endif
};
diff --git a/cpukit/libmisc/monitor/mon-monitor.c b/cpukit/libmisc/monitor/mon-monitor.c
index fe292f29d0..5a9457b9ef 100644
--- a/cpukit/libmisc/monitor/mon-monitor.c
+++ b/cpukit/libmisc/monitor/mon-monitor.c
@@ -223,7 +223,6 @@ static const rtems_monitor_command_entry_t rtems_monitor_commands[] = {
#else
#define RTEMS_MONITOR_POSIX_NEXT 19
#endif
-#ifdef RTEMS_POSIX_API
{ "pthread",
"Display information about the specified pthreads. "
"Default is to display information about all pthreads on this node.\n"
@@ -234,9 +233,6 @@ static const rtems_monitor_command_entry_t rtems_monitor_commands[] = {
&rtems_monitor_commands[RTEMS_MONITOR_POSIX_NEXT],
},
#define RTEMS_MONITOR_DEBUGGER_NEXT (RTEMS_MONITOR_POSIX_NEXT + 1)
-#else
- #define RTEMS_MONITOR_DEBUGGER_NEXT RTEMS_MONITOR_POSIX_NEXT
-#endif
#ifdef CPU_INVOKE_DEBUGGER
{ "debugger",
"Enter the debugger, if possible. "
diff --git a/cpukit/libmisc/monitor/mon-object.c b/cpukit/libmisc/monitor/mon-object.c
index ef32214f3c..039d11fd74 100644
--- a/cpukit/libmisc/monitor/mon-object.c
+++ b/cpukit/libmisc/monitor/mon-object.c
@@ -25,9 +25,7 @@
#include <rtems/rtems/regionimpl.h>
#include <rtems/rtems/semimpl.h>
#include <rtems/rtems/tasksimpl.h>
-#if defined(RTEMS_POSIX_API)
- #include <rtems/posix/pthreadimpl.h>
-#endif
+#include <rtems/posix/pthreadimpl.h>
#include <stdio.h>
#include <stdlib.h> /* strtoul() */
@@ -130,7 +128,6 @@ static const rtems_monitor_object_info_t rtems_monitor_object_info[] =
(rtems_monitor_object_dump_header_fn) rtems_monitor_driver_dump_header,
(rtems_monitor_object_dump_fn) rtems_monitor_driver_dump,
},
-#if defined(RTEMS_POSIX_API)
{ RTEMS_MONITOR_OBJECT_PTHREAD,
(void *) &_POSIX_Threads_Information.Objects,
sizeof(rtems_monitor_task_t),
@@ -138,8 +135,7 @@ static const rtems_monitor_object_info_t rtems_monitor_object_info[] =
(rtems_monitor_object_canonical_fn) rtems_monitor_task_canonical,
(rtems_monitor_object_dump_header_fn) rtems_monitor_task_dump_header,
(rtems_monitor_object_dump_fn) rtems_monitor_task_dump,
- },
-#endif
+ }
};
/*
diff --git a/cpukit/posix/src/psxtransschedparam.c b/cpukit/posix/src/psxtransschedparam.c
index 614c5fb71f..587788cabd 100644
--- a/cpukit/posix/src/psxtransschedparam.c
+++ b/cpukit/posix/src/psxtransschedparam.c
@@ -30,10 +30,8 @@ int _POSIX_Thread_Translate_to_sched_policy(
switch ( budget_algorithm ) {
case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE:
return SCHED_OTHER;
-#if defined(RTEMS_POSIX_API)
case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE:
return SCHED_RR;
-#endif
case THREAD_CPU_BUDGET_ALGORITHM_CALLOUT:
return SCHED_SPORADIC;
default:
@@ -62,13 +60,12 @@ int _POSIX_Thread_Translate_sched_param(
return 0;
}
-#if defined(RTEMS_POSIX_API)
if ( policy == SCHED_RR ) {
*budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE;
return 0;
}
-#endif
+#if defined(RTEMS_POSIX_API)
if ( policy == SCHED_SPORADIC ) {
if ( (param->sched_ss_repl_period.tv_sec == 0) &&
(param->sched_ss_repl_period.tv_nsec == 0) )
@@ -86,6 +83,7 @@ int _POSIX_Thread_Translate_sched_param(
*budget_callout = _POSIX_Threads_Sporadic_budget_callout;
return 0;
}
+#endif
return EINVAL;
}
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index da31252063..0a790f9371 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -34,7 +34,9 @@
#include <rtems/score/wkspace.h>
#include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/priorityimpl.h>
+#if defined(RTEMS_POSIX_API)
#include <rtems/posix/psignalimpl.h>
+#endif
#include <rtems/posix/config.h>
#include <rtems/posix/keyimpl.h>
#include <rtems/score/assert.h>
@@ -42,6 +44,7 @@
Thread_Information _POSIX_Threads_Information;
+#if defined(RTEMS_POSIX_API)
void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
{
POSIX_API_Control *api;
@@ -144,6 +147,7 @@ static void _POSIX_Threads_Terminate_extension( Thread_Control *executing )
_Watchdog_Per_CPU_remove_ticks( &api->Sporadic.Timer );
_Thread_State_release( executing, &lock_context );
}
+#endif
/*
* _POSIX_Threads_Exitted_extension
@@ -164,9 +168,11 @@ static void _POSIX_Threads_Exitted_extension(
User_extensions_Control _POSIX_Threads_User_extensions = {
.Callouts = {
+#if defined(RTEMS_POSIX_API)
.thread_create = _POSIX_Threads_Create_extension,
- .thread_exitted = _POSIX_Threads_Exitted_extension,
- .thread_terminate = _POSIX_Threads_Terminate_extension
+ .thread_terminate = _POSIX_Threads_Terminate_extension,
+#endif
+ .thread_exitted = _POSIX_Threads_Exitted_extension
}
};
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 46fe1e7412..07fded25b4 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -73,14 +73,16 @@ int pthread_create(
Thread_Control *the_thread;
Thread_Control *executing;
const Scheduler_Control *scheduler;
- POSIX_API_Control *api;
- const POSIX_API_Control *executing_api;
int schedpolicy = SCHED_RR;
struct sched_param schedparam;
size_t stacksize;
Objects_Name name;
int error;
ISR_lock_Context lock_context;
+#if defined(RTEMS_POSIX_API)
+ POSIX_API_Control *api;
+ const POSIX_API_Control *executing_api;
+#endif
if ( !start_routine )
return EFAULT;
@@ -242,6 +244,10 @@ int pthread_create(
return EINVAL;
}
+ the_thread->was_created_with_inherited_scheduler =
+ ( the_attr->inheritsched == PTHREAD_INHERIT_SCHED );
+
+#if defined(RTEMS_POSIX_API)
/*
* finish initializing the per API structure
*/
@@ -250,9 +256,6 @@ int pthread_create(
api->signals_unblocked = executing_api->signals_unblocked;
- the_thread->was_created_with_inherited_scheduler =
- ( the_attr->inheritsched == PTHREAD_INHERIT_SCHED );
-
_Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
api->Sporadic.sched_ss_repl_period =
the_attr->schedparam.sched_ss_repl_period;
@@ -264,6 +267,7 @@ int pthread_create(
if ( schedpolicy == SCHED_SPORADIC ) {
_POSIX_Threads_Sporadic_timer( &api->Sporadic.Timer );
}
+#endif
/*
* POSIX threads are allocated and started in one operation.
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 7c5b6f109d..8d87620d93 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -40,12 +40,14 @@ static int _POSIX_Set_sched_param(
)
{
const Scheduler_Control *scheduler;
- POSIX_API_Control *api;
int normal_prio;
- int low_prio;
bool valid;
Priority_Control core_normal_prio;
+#if defined(RTEMS_POSIX_API)
+ POSIX_API_Control *api;
+ int low_prio;
Priority_Control core_low_prio;
+#endif
normal_prio = param->sched_priority;
@@ -56,6 +58,7 @@ static int _POSIX_Set_sched_param(
return EINVAL;
}
+#if defined(RTEMS_POSIX_API)
if ( policy == SCHED_SPORADIC ) {
low_prio = param->sched_ss_low_priority;
} else {
@@ -70,9 +73,11 @@ static int _POSIX_Set_sched_param(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
_Watchdog_Per_CPU_remove_ticks( &api->Sporadic.Timer );
+#endif
_Priority_Node_set_priority( &the_thread->Real_priority, core_normal_prio );
+#if defined(RTEMS_POSIX_API)
if ( _Priority_Node_is_active( &api->Sporadic.Low_priority ) ) {
_Thread_Priority_add(
the_thread,
@@ -86,17 +91,21 @@ static int _POSIX_Set_sched_param(
);
_Priority_Node_set_inactive( &api->Sporadic.Low_priority );
} else {
+#endif
_Thread_Priority_changed(
the_thread,
&the_thread->Real_priority,
false,
queue_context
);
+#if defined(RTEMS_POSIX_API)
}
+#endif
the_thread->budget_algorithm = budget_algorithm;
the_thread->budget_callout = budget_callout;
+#if defined(RTEMS_POSIX_API)
_Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
api->Sporadic.sched_ss_repl_period = param->sched_ss_repl_period;
api->Sporadic.sched_ss_init_budget = param->sched_ss_init_budget;
@@ -105,9 +114,12 @@ static int _POSIX_Set_sched_param(
if ( policy == SCHED_SPORADIC ) {
_POSIX_Threads_Sporadic_timer_insert( the_thread, api );
} else {
+#endif
the_thread->cpu_time_budget =
rtems_configuration_get_ticks_per_timeslice();
+#if defined(RTEMS_POSIX_API)
}
+#endif
return 0;
}
diff --git a/cpukit/rtems/src/rtemsobjectgetapiclassname.c b/cpukit/rtems/src/rtemsobjectgetapiclassname.c
index 3f26f2f25b..a00b06b990 100644
--- a/cpukit/rtems/src/rtemsobjectgetapiclassname.c
+++ b/cpukit/rtems/src/rtemsobjectgetapiclassname.c
@@ -43,9 +43,9 @@ static const rtems_assoc_t rtems_object_api_classic_assoc[] = {
};
static const rtems_assoc_t rtems_object_api_posix_assoc[] = {
-#ifdef RTEMS_POSIX_API
{ "Thread", OBJECTS_POSIX_THREADS, 0},
{ "Key", OBJECTS_POSIX_KEYS, 0},
+#ifdef RTEMS_POSIX_API
{ "Interrupt", OBJECTS_POSIX_INTERRUPTS, 0},
#endif
{ "Message Queue", OBJECTS_POSIX_MESSAGE_QUEUES, 0},
diff --git a/cpukit/score/src/threaditerate.c b/cpukit/score/src/threaditerate.c
index 0f9a1bef44..eff3472d57 100644
--- a/cpukit/score/src/threaditerate.c
+++ b/cpukit/score/src/threaditerate.c
@@ -29,11 +29,9 @@ void _Thread_Iterate(
const Objects_Information *information;
Objects_Maximum i;
-#if !defined(RTEMS_POSIX_API)
if ( _Objects_Information_table[ api_index ] == NULL ) {
continue;
}
-#endif
information = _Objects_Information_table[ api_index ][ 1 ];
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index ae5c3382ae..66cf4df845 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -77,12 +77,9 @@ static void _Thread_Raise_real_priority(
typedef struct {
Thread_queue_Context Base;
-#if defined(RTEMS_POSIX_API)
void *exit_value;
-#endif
} Thread_Join_context;
-#if defined(RTEMS_POSIX_API)
static Thread_Control *_Thread_Join_flush_filter(
Thread_Control *the_thread,
Thread_queue_Queue *queue,
@@ -97,26 +94,19 @@ static Thread_Control *_Thread_Join_flush_filter(
return the_thread;
}
-#endif
static void _Thread_Wake_up_joining_threads( Thread_Control *the_thread )
{
Thread_Join_context join_context;
-#if defined(RTEMS_POSIX_API)
join_context.exit_value = the_thread->Life.exit_value;
-#endif
_Thread_queue_Context_initialize( &join_context.Base );
_Thread_queue_Acquire( &the_thread->Join_queue, &join_context.Base );
_Thread_queue_Flush_critical(
&the_thread->Join_queue.Queue,
THREAD_JOIN_TQ_OPERATIONS,
-#if defined(RTEMS_POSIX_API)
_Thread_Join_flush_filter,
-#else
- _Thread_queue_Flush_default_filter,
-#endif
&join_context.Base
);
}
@@ -289,7 +279,6 @@ static Per_CPU_Control *_Thread_Wait_for_join(
Per_CPU_Control *cpu_self
)
{
-#if defined(RTEMS_POSIX_API)
ISR_lock_Context lock_context;
_Thread_State_acquire( executing, &lock_context );
@@ -308,7 +297,6 @@ static Per_CPU_Control *_Thread_Wait_for_join(
} else {
_Thread_State_release( executing, &lock_context );
}
-#endif
return cpu_self;
}
@@ -442,9 +430,7 @@ void _Thread_Join(
_Assert( the_thread != executing );
_Assert( _Thread_State_is_owner( the_thread ) );
-#if defined(RTEMS_POSIX_API)
executing->Wait.return_argument = NULL;
-#endif
_Thread_queue_Context_set_thread_state( queue_context, waiting_for_join );
_Thread_queue_Enqueue(
@@ -460,9 +446,7 @@ static void _Thread_Set_exit_value(
void *exit_value
)
{
-#if defined(RTEMS_POSIX_API)
the_thread->Life.exit_value = exit_value;
-#endif
}
void _Thread_Cancel(
diff --git a/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c
index 2657ba0dda..c9df793526 100644
--- a/cpukit/score/src/wkspace.c
+++ b/cpukit/score/src/wkspace.c
@@ -53,11 +53,9 @@ static uint32_t _Workspace_Get_maximum_thread_count( void )
Configuration_RTEMS_API.maximum_tasks
);
-#if defined(RTEMS_POSIX_API)
thread_count += rtems_resource_maximum_per_allocation(
_Configuration_POSIX_Maximum_threads
);
-#endif
return thread_count;
}
--
2.16.4
More information about the devel
mailing list