[libc-commits] [PATCH] D147985: [LIBC] Implement `sched_yield()`

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Apr 11 12:55:56 PDT 2023


michaelrj added a comment.

The function looks good, but since you're adding a new function there's a bit of extra configuration that needs to be done. I'll walk you through it here, but if you want an example then this patch should also show what needs to be done: https://reviews.llvm.org/D147970.

First, we need the function to have a `FunctionSpec` in the `spec/` folder. For this function it will be in `spec/gnu_ext.td`, alongside `sched_getaffinity`.
Next, to get the function to build on the target platform we need to add the entrypoint to the list in `config/linux/x86_64/entrypoints.txt`. If you want you can also add it to the entrypoints list for other CPU architectures (e.g. RISC-V), but x86_64 is the most important one for testing.
We require all of the functions to have unit tests, which will go in `test/src/sched/sched_yield_test.cpp`. Don't worry about this making this too complex. This is a simple syscall wrapper so it just needs to test that calling the function succeeds.
Finally, the cmake for the `sched` folder is a little unusual, so you'll also need to add an alias to `src/sched/CMakeLists.txt`.

I know this looks like a lot, but each part should be fairly quick. Feel free to reach out if you want more guidance on how to do it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147985/new/

https://reviews.llvm.org/D147985



More information about the libc-commits mailing list