From 2ecaa462efc710ae8f55af9dd5371b4d67bfd620 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Fri, 2 May 2008 11:16:42 -0400 Subject: Use _GNU_SOURCE for all files. Fix wrong prototypes. --- Makefile | 2 +- include/internal.h | 3 --- src/syscalls.c | 1 - src/task.c | 9 ++++++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 46fd9b3..b84b865 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ else endif -CFLAGS=-Wall -Wdeclaration-after-statement ${INC} ${CPU} -g -D_XOPEN_SOURCE=600 +CFLAGS=-Wall -Wdeclaration-after-statement ${INC} ${CPU} -g -D_XOPEN_SOURCE=600 -D_GNU_SOURCE CPPFLAGS=-Wall -g 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, #endif - -int sched_setscheduler(pid_t pid, int policy, int* prioriy); -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 @@ /* To get syscall() we need to define _GNU_SOURCE * in modern glibc versions. */ -#define _GNU_SOURCE #include #include #include diff --git a/src/task.c b/src/task.c index df12777..f9e4ccf 100644 --- a/src/task.c +++ b/src/task.c @@ -3,6 +3,8 @@ #include #include +#include + #include "litmus.h" #include "internal.h" @@ -61,17 +63,18 @@ int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period) { int task_mode(int mode) { - int prio = 0; + struct sched_param param; int me = gettid(); int policy = sched_getscheduler(gettid()); int old_mode = policy == SCHED_LITMUS ? LITMUS_RT_TASK : BACKGROUND_TASK; + param.sched_priority = 0; if (old_mode == LITMUS_RT_TASK && mode == BACKGROUND_TASK) { /* transition to normal task */ - return sched_setscheduler(me, SCHED_NORMAL, &prio); + return sched_setscheduler(me, SCHED_NORMAL, ¶m); } else if (old_mode == BACKGROUND_TASK && mode == LITMUS_RT_TASK) { /* transition to RT task */ - return sched_setscheduler(me, SCHED_LITMUS, &prio); + return sched_setscheduler(me, SCHED_LITMUS, ¶m); } else { errno = -EINVAL; return -1; -- cgit v1.2.2