aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-01-22 12:04:01 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-01-22 12:04:01 -0500
commitd9f376087182aa679b77d2bc416ade454df5dab1 (patch)
treef6aa2878749c1f7b4d76d8a81a0b14ea6db80652
parent726fc7a6c8e8f8e1036337e1503af0cbb1bb741f (diff)
add set_rt_param() wrapper sporadic_task()
-rw-r--r--include/litmus.h14
-rw-r--r--src/litmus.c11
2 files changed, 17 insertions, 8 deletions
diff --git a/include/litmus.h b/include/litmus.h
index 343aab3..0f96aa7 100644
--- a/include/litmus.h
+++ b/include/litmus.h
@@ -49,13 +49,6 @@ typedef struct rt_param {
49 49
50typedef int pid_t; /* PID of a task */ 50typedef int pid_t; /* PID of a task */
51 51
52/* X */
53#define set_param(t,p,e) do{\
54 (t).is_realtime=1;\
55 (t).exec_cost=(e);\
56 (t).period=(p);\
57 }while(0);
58
59/* scheduler modes */ 52/* scheduler modes */
60#define MODE_NON_RT 0 53#define MODE_NON_RT 0
61#define MODE_RT_RUN 1 54#define MODE_RT_RUN 1
@@ -66,6 +59,13 @@ int set_rt_task_param(pid_t pid, rt_param_t* param);
66int get_rt_task_param(pid_t pid, rt_param_t* param); 59int get_rt_task_param(pid_t pid, rt_param_t* param);
67int prepare_rt_task(pid_t pid); 60int prepare_rt_task(pid_t pid);
68 61
62#define sporadic_gobal(e, p) \
63 sporadic_task(e, p, 0, RT_CLASS_SOFT)
64#define sporadic_partitioned(e, p, cpu) \
65 sporadic_task(e, p, cpu, RT_CLASS_SOFT)
66int sporadic_task(unsigned long exec_cost, unsigned long period,
67 int partition, task_class_t cls);
68
69 69
70enum { 70enum {
71 LITMUS_RESERVED_RANGE = 1024, 71 LITMUS_RESERVED_RANGE = 1024,
diff --git a/src/litmus.c b/src/litmus.c
index 6ca35a3..89d0f86 100644
--- a/src/litmus.c
+++ b/src/litmus.c
@@ -218,7 +218,16 @@ task_class_t str2class(const char* str)
218 return -1; 218 return -1;
219} 219}
220 220
221 221int sporadic_task(unsigned long e, unsigned long p,
222 int cpu, task_class_t cls)
223{
224 rt_param_t param;
225 param.exec_cost = e;
226 param.period = p;
227 param.cpu = cpu;
228 param.cls = cls;
229 return set_rt_task_param(getpid(), &param);
230}
222 231
223struct np_flag { 232struct np_flag {
224 #define RT_PREEMPTIVE 0x2050 /* = NP */ 233 #define RT_PREEMPTIVE 0x2050 /* = NP */