aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/litmus.h2
-rw-r--r--src/litmus.c28
2 files changed, 30 insertions, 0 deletions
diff --git a/include/litmus.h b/include/litmus.h
index 335d01b..429e614 100644
--- a/include/litmus.h
+++ b/include/litmus.h
@@ -18,6 +18,8 @@ extern "C" {
18 18
19#include "migration.h" 19#include "migration.h"
20 20
21
22void init_rt_task_param(struct rt_task* param);
21int set_rt_task_param(pid_t pid, struct rt_task* param); 23int set_rt_task_param(pid_t pid, struct rt_task* param);
22int get_rt_task_param(pid_t pid, struct rt_task* param); 24int get_rt_task_param(pid_t pid, struct rt_task* param);
23 25
diff --git a/src/litmus.c b/src/litmus.c
index 1110bd4..09f9dc6 100644
--- a/src/litmus.c
+++ b/src/litmus.c
@@ -77,6 +77,34 @@ void show_rt_param(struct rt_task* tp)
77 tp->exec_cost, tp->period, tp->cpu); 77 tp->exec_cost, tp->period, tp->cpu);
78} 78}
79 79
80void init_rt_task_param(struct rt_task* tp)
81{
82 /* Defaults:
83 * - implicit deadline (t->relative_deadline == 0)
84 * - phase = 0
85 * - class = RT_CLASS_SOFT
86 * - budget policy = NO_ENFORCEMENT
87 * - fixed priority = LITMUS_LOWEST_PRIORITY
88 * - release policy = SPORADIC
89 * - cpu assignment = 0
90 *
91 * User must still set the following fields to non-zero values:
92 * - tp->exec_cost
93 * - tp->period
94 *
95 * User must set tp->cpu to the appropriate value for non-global
96 * schedulers. For clusters, set tp->cpu to the first CPU in the
97 * assigned cluster.
98 */
99
100 memset(tp, 0, sizeof(*tp));
101
102 tp->cls = RT_CLASS_SOFT;
103 tp->priority = LITMUS_LOWEST_PRIORITY;
104 tp->budget_policy = NO_ENFORCEMENT;
105 tp->release_policy = SPORADIC;
106}
107
80task_class_t str2class(const char* str) 108task_class_t str2class(const char* str)
81{ 109{
82 if (!strcmp(str, "hrt")) 110 if (!strcmp(str, "hrt"))