[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:22:38 PDT 2026
https://github.com/petbernt created https://github.com/llvm/llvm-project/pull/195332
Fixes generated <sched.h> prototypes for sched_getscheduler/sched_setscheduler and adds compile-time public-header coverage
>From f7fc03ffdcc127f05e9327325e7fc6fe2aa2b84f 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 | 7 +++++++
2 files changed, 9 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..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; }
More information about the libc-commits
mailing list