implement stub versions of sched_*
authorRich Felker <dalias@aerifal.cx>
Fri, 4 May 2012 03:18:26 +0000 (23:18 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 4 May 2012 03:18:26 +0000 (23:18 -0400)
these actually work, but for now they prohibit actually setting
priority levels and report min/max priority as 0.

src/misc/sched_yield.c [deleted file]
src/sched/sched_get_priority_max.c [new file with mode: 0644]
src/sched/sched_getparam.c [new file with mode: 0644]
src/sched/sched_getscheduler.c [new file with mode: 0644]
src/sched/sched_rr_get_interval.c [new file with mode: 0644]
src/sched/sched_setparam.c [new file with mode: 0644]
src/sched/sched_setscheduler.c [new file with mode: 0644]
src/sched/sched_yield.c [new file with mode: 0644]

diff --git a/src/misc/sched_yield.c b/src/misc/sched_yield.c
deleted file mode 100644 (file)
index 6c0742b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sched.h>
-#include "syscall.h"
-#include "libc.h"
-
-int __yield()
-{
-       return syscall(SYS_sched_yield);
-}
-
-weak_alias(__yield, sched_yield);
diff --git a/src/sched/sched_get_priority_max.c b/src/sched/sched_get_priority_max.c
new file mode 100644 (file)
index 0000000..64cbca9
--- /dev/null
@@ -0,0 +1,11 @@
+#include <sched.h>
+
+int sched_get_priority_max(int policy)
+{
+       return 0;
+}
+
+int sched_get_priority_min(int policy)
+{
+       return 0;
+}
diff --git a/src/sched/sched_getparam.c b/src/sched/sched_getparam.c
new file mode 100644 (file)
index 0000000..65be107
--- /dev/null
@@ -0,0 +1,7 @@
+#include <sched.h>
+#include "syscall.h"
+
+int sched_getparam(pid_t pid, struct sched_param *param)
+{
+       return syscall(SYS_sched_getparam, pid, param);
+}
diff --git a/src/sched/sched_getscheduler.c b/src/sched/sched_getscheduler.c
new file mode 100644 (file)
index 0000000..4c922f6
--- /dev/null
@@ -0,0 +1,7 @@
+#include <sched.h>
+#include "syscall.h"
+
+int sched_getscheduler(pid_t pid)
+{
+       return syscall(SYS_sched_getscheduler, pid);
+}
diff --git a/src/sched/sched_rr_get_interval.c b/src/sched/sched_rr_get_interval.c
new file mode 100644 (file)
index 0000000..43bc490
--- /dev/null
@@ -0,0 +1,8 @@
+#include <sched.h>
+#include "syscall.h"
+
+int sched_rr_get_interval(pid_t pid, struct timespec *ts)
+{
+       return syscall(SYS_sched_rr_get_interval, pid, ts);
+}
+
diff --git a/src/sched/sched_setparam.c b/src/sched/sched_setparam.c
new file mode 100644 (file)
index 0000000..07d61ae
--- /dev/null
@@ -0,0 +1,8 @@
+#include <sched.h>
+#include "syscall.h"
+
+int sched_setparam(pid_t pid, const struct sched_param *param)
+{
+       static const struct sched_param def;
+       return syscall(SYS_sched_setparam, pid, &def);
+}
diff --git a/src/sched/sched_setscheduler.c b/src/sched/sched_setscheduler.c
new file mode 100644 (file)
index 0000000..acf5dc2
--- /dev/null
@@ -0,0 +1,8 @@
+#include <sched.h>
+#include "syscall.h"
+
+int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
+{
+       static const struct sched_param def;
+       return syscall(SYS_sched_setscheduler, pid, sched, &def);
+}
diff --git a/src/sched/sched_yield.c b/src/sched/sched_yield.c
new file mode 100644 (file)
index 0000000..6c0742b
--- /dev/null
@@ -0,0 +1,10 @@
+#include <sched.h>
+#include "syscall.h"
+#include "libc.h"
+
+int __yield()
+{
+       return syscall(SYS_sched_yield);
+}
+
+weak_alias(__yield, sched_yield);