1From 407c96fc790d0d11ca9603a2a533216c745b5051 Mon Sep 17 00:00:00 2001
2From: Stefan Nickl <Stefan.Nickl@gmail.com>
3Date: Mon, 13 May 2019 22:33:21 +0200
4Subject: [PATCH] Make scheduler functions Linux-compatible
5
6Let sched_getscheduler(), sched_setscheduler(), sched_getparam(),
7sched_setparam() invoke the Linux syscalls of the same name instead
8of returning -ENOSYS.
9
10Signed-off-by: Stefan Nickl <Stefan.Nickl@gmail.com>
11---
12 src/sched/sched_getparam.c     | 3 +--
13 src/sched/sched_getscheduler.c | 3 +--
14 src/sched/sched_setparam.c     | 3 +--
15 src/sched/sched_setscheduler.c | 3 +--
16 4 files changed, 4 insertions(+), 8 deletions(-)
17
18diff --git a/src/sched/sched_getparam.c b/src/sched/sched_getparam.c
19index 76f10e4..65be107 100644
20--- a/src/sched/sched_getparam.c
21+++ b/src/sched/sched_getparam.c
22@@ -1,8 +1,7 @@
23 #include <sched.h>
24-#include <errno.h>
25 #include "syscall.h"
26
27 int sched_getparam(pid_t pid, struct sched_param *param)
28 {
29-	return __syscall_ret(-ENOSYS);
30+	return syscall(SYS_sched_getparam, pid, param);
31 }
32diff --git a/src/sched/sched_getscheduler.c b/src/sched/sched_getscheduler.c
33index 394e508..4c922f6 100644
34--- a/src/sched/sched_getscheduler.c
35+++ b/src/sched/sched_getscheduler.c
36@@ -1,8 +1,7 @@
37 #include <sched.h>
38-#include <errno.h>
39 #include "syscall.h"
40
41 int sched_getscheduler(pid_t pid)
42 {
43-	return __syscall_ret(-ENOSYS);
44+	return syscall(SYS_sched_getscheduler, pid);
45 }
46diff --git a/src/sched/sched_setparam.c b/src/sched/sched_setparam.c
47index 18623ee..f699faf 100644
48--- a/src/sched/sched_setparam.c
49+++ b/src/sched/sched_setparam.c
50@@ -1,8 +1,7 @@
51 #include <sched.h>
52-#include <errno.h>
53 #include "syscall.h"
54
55 int sched_setparam(pid_t pid, const struct sched_param *param)
56 {
57-	return __syscall_ret(-ENOSYS);
58+	return syscall(SYS_sched_setparam, pid, param);
59 }
60diff --git a/src/sched/sched_setscheduler.c b/src/sched/sched_setscheduler.c
61index 4435f21..e678221 100644
62--- a/src/sched/sched_setscheduler.c
63+++ b/src/sched/sched_setscheduler.c
64@@ -1,8 +1,7 @@
65 #include <sched.h>
66-#include <errno.h>
67 #include "syscall.h"
68
69 int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
70 {
71-	return __syscall_ret(-ENOSYS);
72+	return syscall(SYS_sched_setscheduler, pid, sched, param);
73 }
74--
752.21.0
76
77