api: use SS and PS options properly in sched.c
authorSzabolcs Nagy <nsz@port70.net>
Sat, 29 Jun 2013 07:30:06 +0000 (07:30 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Sat, 29 Jun 2013 07:30:06 +0000 (07:30 +0000)
src/api/Makefile
src/api/sched.c

index 146499b..7b7a19a 100644 (file)
@@ -1,5 +1,6 @@
 CFLAGS+=-std=c99 -pedantic-errors -Wall -Werror -Wno-unused -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
-#CFLAGS+=-DX_PS -DX_TPS -DX_TYM -DX_RPP_TPP -DX_FMTMSG -DX_NDBM
+CFLAGS+=-DX_PS -DX_TPS -DX_SS
+#CFLAGS+=-DX_RPP_TPP -DX_TYM -DX_FMTMSG -DX_NDBM
 LDFLAGS+=-lcrypt -ldl -lm -lpthread -lrt
 
 SRC=$(sort $(wildcard *.c))
index 23ce364..365b01f 100644 (file)
@@ -4,36 +4,31 @@
 #define C(n) switch(n){case n:;}
 static void f()
 {
-#ifdef X_PS
-T(pid_t)
-#endif
-T(time_t)
 T(struct timespec)
 {
 struct sched_param x;
 F(int,sched_priority)
+#ifdef X_SS
 F(int,sched_ss_low_priority)
 F(struct timespec,sched_ss_repl_period)
 F(struct timespec,sched_ss_init_budget)
 F(int,sched_ss_max_repl)
-}
-
+T(time_t)
 C(SCHED_SPORADIC)
-{int(*p)(void) = sched_yield;}
-
-#if defined(X_PS) || defined(X_TPS)
+#endif
+}
+#ifdef X_PS
+T(pid_t)
 C(SCHED_FIFO)
 C(SCHED_RR)
 C(SCHED_OTHER)
+{int(*p)(pid_t,struct sched_param*) = sched_getparam;}
+{int(*p)(pid_t) = sched_getscheduler;}
 {int(*p)(int) = sched_get_priority_max;}
 {int(*p)(int) = sched_get_priority_min;}
 {int(*p)(pid_t,struct timespec*) = sched_rr_get_interval;}
-#endif
-
-#ifdef X_PS
-{int(*p)(pid_t,struct sched_param*) = sched_getparam;}
-{int(*p)(pid_t) = sched_getscheduler;}
 {int(*p)(pid_t,const struct sched_param*) = sched_setparam;}
 {int(*p)(pid_t,int,const struct sched_param*) = sched_setscheduler;}
 #endif
+{int(*p)(void) = sched_yield;}
 }