cpu/native,core: better contain ugly hacks#21955
Merged
maribu merged 2 commits intoRIOT-OS:masterfrom Dec 15, 2025
Merged
Conversation
Contributor
dramatic voice ...and Murdock found them. |
79cc98a to
276452a
Compare
External code may assume that RIOT's `sched.h` header is the same as [POSIX's sched.h][1] header. This adds a slim wrapper to not have to patch external code (which in case of glibcxx will be difficult to do). [1]: https://pubs.opengroup.org/onlinepubs/009604299/basedefs/sched.h.html
276452a to
02ea45f
Compare
CPU specific hacks never should go to `core`. This simplifies the hack and moves it to `cpu/native` by providing a custom `sched.h` that adds the workarounds for glibc and adds an `#include_next "sched.h"`. It's a bit of a pity that RIOT's sched.h has a name conflict with POSIX's sched.h - otherwise those hacks wouldn't really be needed.
02ea45f to
646c8b4
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 15, 2025
cpu/native,core: better contain ugly hacks
Member
Author
|
This might need a 2nd ACK, depending on how strict one is with our policies |
Member
|
Sure, we can make this a 2ack |
benpicco
approved these changes
Dec 15, 2025
Member
Author
|
🎉 Thx |
Member
Author
|
This had the unintended side-effect of braking That is going to be interesting to figure out why that breaks it there, and why doesn't it break it on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
RIOT's
sched.hsadly has the same name as POSIX'ssched.h. The filecore/include/native_sched.hprovided the workarounds needed - but we do not want CPU specific hacks incore.Instead:
sched_yield()compat function tocore/schedand document that code in RIOT should be usingthread_yield()insteadsched.hand expect the POSIXsched.hAPIsched.hinnativethat injects some glibc specific workarounds and an#include_next "sched.h"cpu_set_tbeing provided bysched.h(and which glibc'ssched.hwould actually do, but RIOT'ssched.hdoes not).Testing procedure
If that code had any function, Murdock will find it. (Even if the function would only show at runtime, we actually run the tests on
nativein any CI run.)Issues/PRs references
None