[PATCH] chrt: support for musl C library

Rob Landley rob at landley.net
Fri Oct 16 07:25:44 UTC 2020


On 10/15/20 6:26 AM, Christian Eggers wrote:
> Hi Bernhard,
> 
> On Thursday, 15 October 2020, 11:40:03 CEST, Bernhard Reutner-Fischer wrote:
>> On Fri, 11 Sep 2020 17:45:38 +0200
>>
>> Christian Eggers <ceggers at arri.de> wrote:
>>> musl "implements" several sched_xxx() functions by returning ENOSYS. As
>>> an alternative, either pthread_(g|s)etschedparam() or direct syscalls
>>> can be used.
>>
>> I don't like using the syscalls directly in the way you propose below.
> I simply took the same way as the "original" chrt command.

And toybox. (I didn't look at what anybody else did.)

>> OTOH pulling in pthread for the pedantically correct pthread_ functions
>> is crude.
>> But then, nowadays, the Threads option is part of Base, so what exactly
>> is the objection from the musl folks so they stub out
>> sched_getscheduler?
>
> The reasons can be read here:
> https://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5
> 
> In short: The musl developers

Developer. This is Rich Felker's personal opinion.

> feel that the Linux kernel implements the
> sched_* syscalls wrong. In order to protect musl users from using this wrong
> syscalls, musl simply returns -ENOSYS in it's stubs.

He actually ripped OUT a correct implementation, and replaced it with nothing,
because he doesn't like Linux syscalls and couldn't get the Linux devs to see it
his way:

  http://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5

> I think there is no way to discuss this with the musl developer(s) nor Linus
> Torvalds.

I've tried discussing it with the musl developer. As with not having a #define
identifying musl, and having a broken fork() on nommu systems that prevents
compile-time probes when cross compiling, he is not open to discussion.

> If busybox wants to use this functionality, we have the "pthread"
> and "syscall" options. Using the latter one in this case would keep the code
> in sync with the original chrt command.

The point of chrt is to call the syscall. The man page says "manipulate the
real-time attributes of a process" (not thread), and "renice" also works on a
PID instead of a TID.

Rob


More information about the busybox mailing list