[libc-commits] [libc] [libc][sched] Fix generated scheduler prototypes (PR #195332)

via libc-commits libc-commits at lists.llvm.org
Fri May 1 12:23:19 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petter Berntsson (petbernt)

<details>
<summary>Changes</summary>

Fixes generated <sched.h> prototypes for sched_getscheduler/sched_setscheduler and adds compile-time public-header coverage

---
Full diff: https://github.com/llvm/llvm-project/pull/195332.diff


2 Files Affected:

- (modified) libc/include/sched.yaml (+2-2) 
- (modified) libc/test/include/sched_test.cpp (+7) 


``````````diff
diff --git a/libc/include/sched.yaml b/libc/include/sched.yaml
index 33731acf4facd..fe0452cbddfce 100644
--- a/libc/include/sched.yaml
+++ b/libc/include/sched.yaml
@@ -94,8 +94,6 @@ functions:
     return_type: int
     arguments:
       - type: pid_t
-      - type: int
-      - type: const struct sched_param *
   - name: sched_rr_get_interval
     standards:
       - POSIX
@@ -124,6 +122,8 @@ functions:
     return_type: int
     arguments:
       - type: pid_t
+      - type: int
+      - type: const struct sched_param *
   - name: sched_yield
     standards:
       - POSIX
diff --git a/libc/test/include/sched_test.cpp b/libc/test/include/sched_test.cpp
index 2a189a571b13f..f87e156ee0a83 100644
--- a/libc/test/include/sched_test.cpp
+++ b/libc/test/include/sched_test.cpp
@@ -23,4 +23,11 @@ static_assert(SameType<decltype(CPU_COUNT((cpu_set_t *)0)), int>::value, "");
 static_assert(SameType<decltype(CPU_SET(0, (cpu_set_t *)0)), void>::value, "");
 static_assert(SameType<decltype(CPU_ISSET(0, (cpu_set_t *)0)), int>::value, "");
 
+static_assert(
+    SameType<decltype(sched_getscheduler((pid_t)0)), int>::value, "");
+static_assert(SameType<decltype(sched_setscheduler(
+                            (pid_t)0, SCHED_OTHER,
+                            (const struct sched_param *)0)), int>::value,
+              "");
+
 extern "C" int main() { return 0; }

``````````

</details>


https://github.com/llvm/llvm-project/pull/195332


More information about the libc-commits mailing list