From: stefan.nickl at gmail.com <stefan.nickl@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/musl: Make scheduler functions Linux-compatible
Date: Tue, 14 May 2019 18:32:32 +0200 [thread overview]
Message-ID: <071f102e7135306dfdba3203fbd35bdc07aa185f.camel@gmail.com> (raw)
In-Reply-To: <20190513221341.4150ab0c@windsurf.home>
Hi Thomas,
thanks for considering.
This has the inner patch also generated by git.
Cheers,
Stefan
Signed-off-by: Stefan Nickl <Stefan.Nickl@gmail.com>
---
...e-scheduler-functions-Linux-compatib.patch | 92 +++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 package/musl/0002-package-musl-Make-scheduler-functions-Linux-compatib.patch
diff --git a/package/musl/0002-package-musl-Make-scheduler-functions-Linux-compatib.patch b/package/musl/0002-package-musl-Make-scheduler-functions-Linux-compatib.patch
new file mode 100644
index 0000000000..a8dbb9eaa5
--- /dev/null
+++ b/package/musl/0002-package-musl-Make-scheduler-functions-Linux-compatib.patch
@@ -0,0 +1,92 @@
+From 775a6cf46a7918cde335f959e1a63119c74e68d3 Mon Sep 17 00:00:00 2001
+From: Stefan Nickl <Stefan.Nickl@gmail.com>
+Date: Mon, 13 May 2019 22:33:21 +0200
+Subject: [PATCH] package/musl: Make scheduler functions Linux-compatible
+
+The POSIX functions sched_getscheduler(), sched_setscheduler(),
+sched_getparam(), sched_setparam() are technically not correctly
+implemented by the Linux syscalls of the same name, because what the
+kernel calls a PID and what POSIX calls a PID isn't truly the same,
+resulting in somewhat different semantics as to what these functions
+exactly apply to.
+
+Since the musl developers put a high premium on POSIX compliance, they
+deliberately implement these functions to return -ENOSYS instead of
+relaying them to the respective Linux syscalls as glibc/uClibc do.
+
+This means that virtually all programs written for Linux using these
+functions are currently broken. For example running 'chrt -p 1' fails
+with "Function not implemented" on a musl-libc based system.
+
+While the musl developers are right strictly speaking, it seems
+unfeasible to fix all affected programs in a way that hardly any Linux
+developer will consider to be broken in the first place. So this patch
+simply changes musl to fall in line with the other libcs.
+
+Signed-off-by: Stefan Nickl <Stefan.Nickl@gmail.com>
+---
+ src/sched/sched_getparam.c | 3 +--
+ src/sched/sched_getscheduler.c | 3 +--
+ src/sched/sched_setparam.c | 3 +--
+ src/sched/sched_setscheduler.c | 3 +--
+ 4 files changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/src/sched/sched_getparam.c b/src/sched/sched_getparam.c
+index 76f10e4..65be107 100644
+--- a/src/sched/sched_getparam.c
++++ b/src/sched/sched_getparam.c
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_getparam(pid_t pid, struct sched_param *param)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_getparam, pid, param);
+ }
+diff --git a/src/sched/sched_getscheduler.c b/src/sched/sched_getscheduler.c
+index 394e508..4c922f6 100644
+--- a/src/sched/sched_getscheduler.c
++++ b/src/sched/sched_getscheduler.c
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_getscheduler(pid_t pid)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_getscheduler, pid);
+ }
+diff --git a/src/sched/sched_setparam.c b/src/sched/sched_setparam.c
+index 18623ee..f699faf 100644
+--- a/src/sched/sched_setparam.c
++++ b/src/sched/sched_setparam.c
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_setparam(pid_t pid, const struct sched_param *param)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_setparam, pid, param);
+ }
+diff --git a/src/sched/sched_setscheduler.c b/src/sched/sched_setscheduler.c
+index 4435f21..e678221 100644
+--- a/src/sched/sched_setscheduler.c
++++ b/src/sched/sched_setscheduler.c
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_setscheduler, pid, sched, param);
+ }
+--
+2.21.0
+
--
2.21.0
next prev parent reply other threads:[~2019-05-14 16:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 20:00 [Buildroot] [PATCH] package/musl: Make scheduler functions Linux-compatible stefan.nickl at gmail.com
2019-05-13 20:13 ` Thomas Petazzoni
2019-05-14 16:32 ` stefan.nickl at gmail.com [this message]
2019-05-14 16:33 ` Thomas Petazzoni
[not found] ` <a03605e62a3879a0fffcbd14be04907cc3e54d3c.camel@gmail.com>
2019-05-14 16:55 ` Thomas Petazzoni
2019-05-14 17:31 ` stefan.nickl at gmail.com
2019-05-14 18:04 ` Arnout Vandecappelle
2019-05-14 18:54 ` stefan.nickl at gmail.com
2019-05-14 19:38 ` Arnout Vandecappelle
2019-05-14 20:03 ` stefan.nickl at gmail.com
2019-05-14 20:24 ` Yann E. MORIN
2019-05-14 20:40 ` stefan.nickl at gmail.com
2019-10-27 17:14 ` Arnout Vandecappelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=071f102e7135306dfdba3203fbd35bdc07aa185f.camel@gmail.com \
--to=stefan.nickl@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox