|
|
Log in / Subscribe / Register

musl C and sched.h

musl C and sched.h

Posted Nov 17, 2020 13:05 UTC (Tue) by binkley (subscriber, #8537)
Parent article: A realtime developer's checklist

Perhaps the situation is rapidly changing, but when I check the musl C source repo, I do see `sched.h`:

https://git.musl-libc.org/cgit/musl/log/?qt=grep&q=sc...

re: _a member of the audience noted that the musl C library does not implement [sched.h]_

What might be meant is that musl's implementation is incomplete for the purposes of the talk.


to post comments

musl C and sched.h

Posted Nov 18, 2020 5:35 UTC (Wed) by mrybczyn (subscriber, #81776) [Link] (2 responses)

Thanks for the comment (I'm the author of the article).

Musl does include the sched_* functions, but they are not really implemented. Please check out https://git.musl-libc.org/cgit/musl/tree/src/sched/sched_... for example. It just returns an error. This is what the discussion covered.

musl C and sched.h

Posted Dec 3, 2020 3:05 UTC (Thu) by Hello71 (guest, #103412) [Link] (1 responses)

This is not accurate. musl implements the majority of the sched_* functions, including sched_setaffinity, sched_getaffinity, sched_get_priority_max, sched_get_priority_min, sched_getcpu, sched_rr_get_interval, and sched_yield. The only ones not implemented are sched_{get,set}{param,scheduler}. As explained by musl author Rich Felker at https://www.openwall.com/lists/musl/2016/03/01/4, this is because on Linux, these syscalls operate on a per-thread basis, but POSIX requires them to operate on a per-process basis. However, as he explains, the fix is to simply use pthread_{get,set}schedparam instead.

musl C and sched.h

Posted Dec 4, 2020 7:37 UTC (Fri) by mrybczyn (subscriber, #81776) [Link]

Thank you for the clarification!


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds