[Toybox] musl intentionally broke chrt
enh
enh at google.com
Tue Aug 29 08:32:32 PDT 2017
can't you just infer musl from the relatively small ?
#if defined(__linux__) && (!defined(__BIONIC__) && !defined(__GLIBC__)
&& whatever ulibc is if you haven't given up on that yet)
#define __MUSL__
#endif
?
On Mon, Aug 28, 2017 at 10:35 PM, Rob Landley <rob at landley.net> wrote:
> The point of chrt is to use the sched_setscheduler() syscall to change a
> PID's scheduler category (by default making it a realtime process), but
> the musl-libc maintainer decided he didn't like that system call and
> changed the wrapper to return -ENOSYS instead of making the system call:
>
> https://git.musl-libc.org/cgit/musl/commit?id=1e21e78bf7a5c24c217446d8760be7b7188711c2
>
> Unfortunately musl-libc has a policy that musl is never wrong and thus
> it doesn't provide a #define __MUSL__ that you can test against to work
> around this kind of breakage, the way every other libc does.
>
> http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
>
> I did a quick stab at replacing sched_setscheduler() with a wrapper that
> calls syscall(NR_sched_setscheduler) but that musl commit broke _all_
> the sched functions, sched_get_priority_max() and so on. I'd have to
> wrap all of them, even on systems that provide non-broken wrappers for
> the Linux syscall.
>
> This is why we have the TOYBOX_MUSL_NOMMU_IS_BROKEN config symbol, for a
> similar case where for 20 years nommu linux let you tell if you were
> building for a system with mmu or without it by a simple compile time
> probe: build a hello world that links against fork(); if it's not there
> it's a nommu system. Rich decided he didn't like that, and provided a
> broken fork() (always returns -ENOSYS) for nommu systems so you can't
> tell at compile time whether it's mmu or not.
>
> I'm trying to figure out if I should just leave chrt broken on musl and
> add a FAQ entry about it. If there was an #ifdef __MUSL__ I'd have the
> build produce a warning and the runtime produce a message, but of course
> there isn't...
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
More information about the Toybox
mailing list