summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-17 09:20:20 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-17 11:10:00 +0200
commit3f3f42482daa45aff3647f34afb4e2c4eca242cd (patch)
treeff7e96eddeacf3ea09547d1f7b3b2fb83f9b4e7d /cpukit/posix/src
parent2be22d4f6478e80cd7df05b888650d1563d2b504 (diff)
downloadrtems-3f3f42482daa45aff3647f34afb4e2c4eca242cd.tar.bz2
posix: Remove POSIX_API_Control::schedparam
Move sporadic server scheduler parameters to POSIX_API_Control::Sporadic. Remove redundant scheduler priority parameter. Update #2514.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/pthread.c6
-rw-r--r--cpukit/posix/src/pthreadcreate.c8
-rw-r--r--cpukit/posix/src/pthreadgetattrnp.c24
-rw-r--r--cpukit/posix/src/pthreadgetschedparam.c4
-rw-r--r--cpukit/posix/src/pthreadsetschedparam.c27
5 files changed, 43 insertions, 26 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 291b19532d..8bd44ca03a 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -126,12 +126,6 @@ static bool _POSIX_Threads_Create_extension(
api = created->API_Extensions[ THREAD_API_POSIX ];
- /* XXX check all fields are touched */
- api->schedparam.sched_priority = _POSIX_Priority_From_core(
- _Thread_Scheduler_get_home( created ),
- _Thread_Get_priority( created )
- );
-
/*
* If the thread is not a posix thread, then all posix signals are blocked
* by default.
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index d8cafe52ce..0de566f7c2 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -241,8 +241,14 @@ int pthread_create(
api->created_with_explicit_scheduler =
( the_attr->inheritsched == PTHREAD_EXPLICIT_SCHED );
api->schedpolicy = the_attr->schedpolicy;
- api->schedparam = the_attr->schedparam;
+
_Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
+ api->Sporadic.sched_ss_repl_period =
+ the_attr->schedparam.sched_ss_repl_period;
+ api->Sporadic.sched_ss_init_budget =
+ the_attr->schedparam.sched_ss_init_budget;
+ api->Sporadic.sched_ss_max_repl =
+ the_attr->schedparam.sched_ss_max_repl;
if ( schedpolicy == SCHED_SPORADIC ) {
_POSIX_Threads_Sporadic_timer( &api->Sporadic.Timer );
diff --git a/cpukit/posix/src/pthreadgetattrnp.c b/cpukit/posix/src/pthreadgetattrnp.c
index d815fc8c53..bebf35e4d6 100644
--- a/cpukit/posix/src/pthreadgetattrnp.c
+++ b/cpukit/posix/src/pthreadgetattrnp.c
@@ -24,6 +24,8 @@
#include <string.h>
#include <rtems/posix/pthreadimpl.h>
+#include <rtems/posix/pthreadattrimpl.h>
+#include <rtems/posix/priorityimpl.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/threadimpl.h>
@@ -32,10 +34,11 @@ int pthread_getattr_np(
pthread_attr_t *attr
)
{
- Thread_Control *the_thread;
- ISR_lock_Context lock_context;
- POSIX_API_Control *api;
- bool ok;
+ Thread_Control *the_thread;
+ ISR_lock_Context lock_context;
+ POSIX_API_Control *api;
+ const Scheduler_Control *scheduler;
+ bool ok;
if ( attr == NULL ) {
return EINVAL;
@@ -65,7 +68,18 @@ int pthread_getattr_np(
}
attr->schedpolicy = api->schedpolicy;
- attr->schedparam = api->schedparam;
+
+ scheduler = _Thread_Scheduler_get_home( the_thread );
+ attr->schedparam.sched_priority = _POSIX_Priority_From_core(
+ scheduler,
+ _Thread_Get_priority( the_thread )
+ );
+ _POSIX_Threads_Get_sched_param_sporadic(
+ the_thread,
+ api,
+ scheduler,
+ &attr->schedparam
+ );
attr->cputime_clock_allowed = 1;
if ( _Thread_Is_joinable( the_thread ) ) {
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index f172caecd4..a5494b5922 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <rtems/posix/pthreadimpl.h>
+#include <rtems/posix/pthreadattrimpl.h>
#include <rtems/posix/priorityimpl.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/threadimpl.h>
@@ -57,9 +58,8 @@ int pthread_getschedparam(
_Thread_Wait_acquire_critical( the_thread, &queue_context );
*policy = api->schedpolicy;
- *param = api->schedparam;
-
scheduler = _Thread_Scheduler_get_home( the_thread );
+ _POSIX_Threads_Get_sched_param_sporadic( the_thread, api, scheduler, param );
priority = the_thread->Real_priority.priority;
_Thread_Wait_release( the_thread, &queue_context );
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 3bd5bc4f3a..c22d4f59b1 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -41,28 +41,28 @@ static int _POSIX_Set_sched_param(
{
const Scheduler_Control *scheduler;
POSIX_API_Control *api;
+ int normal_prio;
int low_prio;
- int high_prio;
bool valid;
Priority_Control core_normal_prio;
Priority_Control core_low_prio;
- if ( policy == SCHED_SPORADIC ) {
- low_prio = param->sched_ss_low_priority;
- high_prio = param->sched_priority;
- } else {
- low_prio = param->sched_priority;
- high_prio = low_prio;
- }
+ normal_prio = param->sched_priority;
scheduler = _Thread_Scheduler_get_home( the_thread );
- core_normal_prio = _POSIX_Priority_To_core( scheduler, low_prio, &valid );
+ core_normal_prio = _POSIX_Priority_To_core( scheduler, normal_prio, &valid );
if ( !valid ) {
return EINVAL;
}
- core_low_prio = _POSIX_Priority_To_core( scheduler, high_prio, &valid );
+ if ( policy == SCHED_SPORADIC ) {
+ low_prio = param->sched_ss_low_priority;
+ } else {
+ low_prio = normal_prio;
+ }
+
+ core_low_prio = _POSIX_Priority_To_core( scheduler, low_prio, &valid );
if ( !valid ) {
return EINVAL;
}
@@ -95,13 +95,16 @@ static int _POSIX_Set_sched_param(
}
api->schedpolicy = policy;
- api->schedparam = *param;
the_thread->budget_algorithm = budget_algorithm;
the_thread->budget_callout = budget_callout;
+ _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;
+ api->Sporadic.sched_ss_max_repl = param->sched_ss_max_repl;
+
if ( policy == SCHED_SPORADIC ) {
- _Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
_POSIX_Threads_Sporadic_timer_insert( the_thread, api );
} else {
the_thread->cpu_time_budget =