aboutsummaryrefslogtreecommitdiffstats
path: root/src/task.c
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2014-05-09 05:11:35 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2014-06-03 02:38:40 -0400
commit4cc5780a04d827e075a383b2c37a7fca304c3607 (patch)
tree65cd2b416e14fa85e85c8dac6ab024b4f84e9f2a /src/task.c
parenta5df594496740ef2284fdaab8430af84e835ad57 (diff)
Modernize rt_launch; remove internal API cruft
Switch rt_launch to use a more modern way to launch real-time tasks. This makes rt_launch more flexible, makes it more similar to rtspin, and also allows to let us get rid of a chunk of old, inflexible code in liblitmus that wasn't really serving any useful purpose anymore.
Diffstat (limited to 'src/task.c')
-rw-r--r--src/task.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/task.c b/src/task.c
index cd78aa9..3e3950c 100644
--- a/src/task.c
+++ b/src/task.c
@@ -8,64 +8,6 @@
8#include "litmus.h" 8#include "litmus.h"
9#include "internal.h" 9#include "internal.h"
10 10
11static void tperrorx(char* msg)
12{
13 fprintf(stderr,
14 "Task %d: %s: %m",
15 gettid(), msg);
16 exit(-1);
17}
18
19/* common launch routine */
20int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, rt_setup_fn_t setup,
21 void* setup_arg)
22{
23 int ret;
24 int rt_task = fork();
25
26 if (rt_task == 0) {
27 /* we are the real-time task
28 * launch task and die when it is done
29 */
30 rt_task = gettid();
31 ret = setup(rt_task, setup_arg);
32 if (ret < 0)
33 tperrorx("could not setup task parameters");
34 ret = task_mode(LITMUS_RT_TASK);
35 if (ret < 0)
36 tperrorx("could not become real-time task");
37 exit(rt_prog(rt_arg));
38 }
39
40 return rt_task;
41}
42
43int __create_rt_task(rt_fn_t rt_prog, void *arg, int cluster,
44 lt_t wcet, lt_t period, unsigned int priority, task_class_t class)
45{
46 struct rt_task params;
47 init_rt_task_param(&params);
48 params.cpu = domain_to_first_cpu(cluster);
49 params.period = period;
50 params.exec_cost = wcet;
51 params.cls = class;
52 params.phase = 0;
53 params.priority = priority;
54 /* enforce budget for tasks that might not use sleep_next_period() */
55 params.budget_policy = QUANTUM_ENFORCEMENT;
56
57 return __launch_rt_task(rt_prog, arg,
58 (rt_setup_fn_t) set_rt_task_param, &params);
59}
60
61int create_rt_task(rt_fn_t rt_prog, void *arg, int cluster,
62 lt_t wcet, lt_t period, unsigned int prio)
63{
64 return __create_rt_task(rt_prog, arg, cluster, wcet, period,
65 prio, RT_CLASS_HARD);
66}
67
68
69#define SCHED_NORMAL 0 11#define SCHED_NORMAL 0
70 12
71int task_mode(int mode) 13int task_mode(int mode)