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

Petter Berntsson via libc-commits libc-commits at lists.llvm.org
Fri May 1 12:39:51 PDT 2026


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

>From 28a470447ae695a4ecd0122193c384e2146a807e Mon Sep 17 00:00:00 2001
From: Petter Berntsson <petter.berntsson at arm.com>
Date: Fri, 1 May 2026 19:56:25 +0100
Subject: [PATCH] [libc][sched] Fix generated scheduler prototypes

---
 libc/include/sched.yaml          | 4 ++--
 libc/test/include/sched_test.cpp | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

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..0838dbf24ad4c 100644
--- a/libc/test/include/sched_test.cpp
+++ b/libc/test/include/sched_test.cpp
@@ -23,4 +23,12 @@ 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, "");
 
+using SchedGetSchedulerT = int(pid_t) noexcept;
+using SchedSetSchedulerT = int(pid_t, int, const struct sched_param *) noexcept;
+
+static_assert(SameType<decltype(sched_getscheduler), SchedGetSchedulerT>::value,
+              "");
+static_assert(SameType<decltype(sched_setscheduler), SchedSetSchedulerT>::value,
+              "");
+
 extern "C" int main() { return 0; }



More information about the libc-commits mailing list