[libc-commits] [libc] 2c27433 - [libc][sched] Fix generated scheduler prototypes (#195332)
via libc-commits
libc-commits at lists.llvm.org
Tue May 5 18:32:44 PDT 2026
Author: Petter Berntsson
Date: 2026-05-05T18:32:40-07:00
New Revision: 2c2743366efd06f5cadea1bda0f20a99b30d553c
URL: https://github.com/llvm/llvm-project/commit/2c2743366efd06f5cadea1bda0f20a99b30d553c
DIFF: https://github.com/llvm/llvm-project/commit/2c2743366efd06f5cadea1bda0f20a99b30d553c.diff
LOG: [libc][sched] Fix generated scheduler prototypes (#195332)
Fixes generated <sched.h> prototypes for
sched_getscheduler/sched_setscheduler and adds compile-time
public-header coverage
Added:
Modified:
libc/include/sched.yaml
libc/test/include/sched_test.cpp
Removed:
################################################################################
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