Commit ac8a0377 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka
Browse files

lib: y2038: convert to internal timespec type


Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 4dc1ffb5
......@@ -1410,11 +1410,14 @@ int rt_task_slice(RT_TASK *task, RTIME quantum)
param_ex.sched_priority = threadobj_get_priority(&tcb->thobj);
if (quantum) {
struct timespec ts;
policy = SCHED_RR;
clockobj_ticks_to_timespec(&alchemy_clock, quantum,
&param_ex.sched_rr_quantum);
} else
clockobj_ticks_to_timespec(&alchemy_clock, quantum, &ts);
param_ex.sched_rr_quantum.tv_sec = ts.tv_sec;
param_ex.sched_rr_quantum.tv_nsec = ts.tv_nsec;
} else {
policy = param_ex.sched_priority ? SCHED_FIFO : SCHED_OTHER;
}
ret = threadobj_set_schedparam(&tcb->thobj, policy, &param_ex);
switch (ret) {
......
......@@ -1741,7 +1741,8 @@ int threadobj_set_schedparam(struct threadobj *thobj, int policy,
ret = enable_rr_corespec(thobj, param_ex);
if (ret)
return __bt(ret);
thobj->tslice = param_ex->sched_rr_quantum;
thobj->tslice.tv_sec = param_ex->sched_rr_quantum.tv_sec;
thobj->tslice.tv_nsec = param_ex->sched_rr_quantum.tv_nsec;
} else if (thobj->policy == SCHED_RR) /* Switching off round-robin. */
disable_rr_corespec(thobj);
......@@ -1761,8 +1762,10 @@ int threadobj_set_schedprio(struct threadobj *thobj, int priority)
param_ex.sched_priority = priority;
policy = thobj->policy;
if (policy == SCHED_RR)
param_ex.sched_rr_quantum = thobj->tslice;
if (policy == SCHED_RR) {
param_ex.sched_rr_quantum.tv_sec = thobj->tslice.tv_sec;
param_ex.sched_rr_quantum.tv_nsec = thobj->tslice.tv_nsec;
}
return threadobj_set_schedparam(thobj, policy, &param_ex);
}
......
......@@ -192,7 +192,8 @@ static void *task_trampoline(void *arg)
if (task->mode & T_TSLICE) {
param_ex.sched_priority = threadobj_get_priority(&task->thobj);
param_ex.sched_rr_quantum = psos_rrperiod;
param_ex.sched_rr_quantum.tv_sec = psos_rrperiod.tv_sec;
param_ex.sched_rr_quantum.tv_nsec = psos_rrperiod.tv_nsec;
threadobj_set_schedparam(&task->thobj, SCHED_RR, &param_ex);
}
......@@ -630,9 +631,11 @@ u_long t_mode(u_long mask, u_long newmask, u_long *oldmode_r)
if (task->mode & T_TSLICE) {
policy = SCHED_RR;
param_ex.sched_rr_quantum = psos_rrperiod;
} else
param_ex.sched_rr_quantum.tv_sec = psos_rrperiod.tv_sec;
param_ex.sched_rr_quantum.tv_nsec = psos_rrperiod.tv_nsec;
} else {
policy = param_ex.sched_priority ? SCHED_FIFO : SCHED_OTHER;
}
/* Working on self, so -EIDRM can't happen. */
threadobj_set_schedparam(&task->thobj, policy, &param_ex);
......
......@@ -30,9 +30,11 @@ static int switch_slicing(struct threadobj *thobj, struct timespec *quantum)
if (quantum) {
policy = SCHED_RR;
param_ex.sched_rr_quantum = *quantum;
} else
param_ex.sched_rr_quantum.tv_sec = quantum->tv_sec;
param_ex.sched_rr_quantum.tv_nsec = quantum->tv_nsec;
} else {
policy = param_ex.sched_priority ? SCHED_FIFO : SCHED_OTHER;
}
return threadobj_set_schedparam(thobj, policy, &param_ex);
}
......
......@@ -265,8 +265,10 @@ static void *task_trampoline(void *arg)
/* Turn on time slicing if RR globally enabled. */
if (wind_time_slice) {
clockobj_ticks_to_timespec(&wind_clock, wind_time_slice,
&param_ex.sched_rr_quantum);
struct timespec ts;
clockobj_ticks_to_timespec(&wind_clock, wind_time_slice, &ts);
param_ex.sched_rr_quantum.tv_sec = ts.tv_sec;
param_ex.sched_rr_quantum.tv_nsec = ts.tv_nsec;
threadobj_lock(&task->thobj);
param_ex.sched_priority = threadobj_get_priority(&task->thobj);
threadobj_set_schedparam(&task->thobj, SCHED_RR, &param_ex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment