diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-02 11:16:42 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-02 11:16:42 -0400 |
commit | 2ecaa462efc710ae8f55af9dd5371b4d67bfd620 (patch) | |
tree | dc25beae0ffc4a0e41084d3ade3e80a5d434e128 | |
parent | 1cea952a55ff91028b4e7f89be26efd3a2cbe04b (diff) |
Use _GNU_SOURCE for all files. Fix wrong prototypes.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | include/internal.h | 3 | ||||
-rw-r--r-- | src/syscalls.c | 1 | ||||
-rw-r--r-- | src/task.c | 9 |
4 files changed, 7 insertions, 8 deletions
@@ -11,7 +11,7 @@ else | |||
11 | endif | 11 | endif |
12 | 12 | ||
13 | 13 | ||
14 | CFLAGS=-Wall -Wdeclaration-after-statement ${INC} ${CPU} -g -D_XOPEN_SOURCE=600 | 14 | CFLAGS=-Wall -Wdeclaration-after-statement ${INC} ${CPU} -g -D_XOPEN_SOURCE=600 -D_GNU_SOURCE |
15 | CPPFLAGS=-Wall -g | 15 | CPPFLAGS=-Wall -g |
16 | 16 | ||
17 | LIBS= ./liblitmus.a | 17 | LIBS= ./liblitmus.a |
diff --git a/include/internal.h b/include/internal.h index 761c434..fc88ef5 100644 --- a/include/internal.h +++ b/include/internal.h | |||
@@ -20,6 +20,3 @@ int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, | |||
20 | 20 | ||
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | |||
24 | int sched_setscheduler(pid_t pid, int policy, int* prioriy); | ||
25 | int sched_getscheduler(pid_t pid); | ||
diff --git a/src/syscalls.c b/src/syscalls.c index bc14443..b2ab900 100644 --- a/src/syscalls.c +++ b/src/syscalls.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* To get syscall() we need to define _GNU_SOURCE | 1 | /* To get syscall() we need to define _GNU_SOURCE |
2 | * in modern glibc versions. | 2 | * in modern glibc versions. |
3 | */ | 3 | */ |
4 | #define _GNU_SOURCE | ||
5 | #include <unistd.h> | 4 | #include <unistd.h> |
6 | #include <linux/unistd.h> | 5 | #include <linux/unistd.h> |
7 | #include <sys/types.h> | 6 | #include <sys/types.h> |
@@ -3,6 +3,8 @@ | |||
3 | #include <unistd.h> | 3 | #include <unistd.h> |
4 | #include <errno.h> | 4 | #include <errno.h> |
5 | 5 | ||
6 | #include <sched.h> | ||
7 | |||
6 | #include "litmus.h" | 8 | #include "litmus.h" |
7 | #include "internal.h" | 9 | #include "internal.h" |
8 | 10 | ||
@@ -61,17 +63,18 @@ int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period) { | |||
61 | 63 | ||
62 | int task_mode(int mode) | 64 | int task_mode(int mode) |
63 | { | 65 | { |
64 | int prio = 0; | 66 | struct sched_param param; |
65 | int me = gettid(); | 67 | int me = gettid(); |
66 | int policy = sched_getscheduler(gettid()); | 68 | int policy = sched_getscheduler(gettid()); |
67 | int old_mode = policy == SCHED_LITMUS ? LITMUS_RT_TASK : BACKGROUND_TASK; | 69 | int old_mode = policy == SCHED_LITMUS ? LITMUS_RT_TASK : BACKGROUND_TASK; |
68 | 70 | ||
71 | param.sched_priority = 0; | ||
69 | if (old_mode == LITMUS_RT_TASK && mode == BACKGROUND_TASK) { | 72 | if (old_mode == LITMUS_RT_TASK && mode == BACKGROUND_TASK) { |
70 | /* transition to normal task */ | 73 | /* transition to normal task */ |
71 | return sched_setscheduler(me, SCHED_NORMAL, &prio); | 74 | return sched_setscheduler(me, SCHED_NORMAL, ¶m); |
72 | } else if (old_mode == BACKGROUND_TASK && mode == LITMUS_RT_TASK) { | 75 | } else if (old_mode == BACKGROUND_TASK && mode == LITMUS_RT_TASK) { |
73 | /* transition to RT task */ | 76 | /* transition to RT task */ |
74 | return sched_setscheduler(me, SCHED_LITMUS, &prio); | 77 | return sched_setscheduler(me, SCHED_LITMUS, ¶m); |
75 | } else { | 78 | } else { |
76 | errno = -EINVAL; | 79 | errno = -EINVAL; |
77 | return -1; | 80 | return -1; |