sched_setscheduler(pid, sched_getscheduler(pid), param) should behave like sched_setparam(pid, param).
-- Regards, Christian
From a67e6679cc2bb199713b1f783d5219cb8364f5f4 Mon Sep 17 00:00:00 2001 From: Christian Franke <christian.fra...@t-online.de> Date: Sat, 23 Nov 2024 19:50:29 +0100 Subject: [PATCH] Cygwin: sched_setscheduler: allow changes of the priority Behave like sched_setparam() if the requested policy is identical to the fixed value (SCHED_FIFO) returned by sched_getscheduler(). Signed-off-by: Christian Franke <christian.fra...@t-online.de> --- winsup/cygwin/release/3.6.0 | 3 +++ winsup/cygwin/sched.cc | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/release/3.6.0 b/winsup/cygwin/release/3.6.0 index 468a2ab24..09aa5376e 100644 --- a/winsup/cygwin/release/3.6.0 +++ b/winsup/cygwin/release/3.6.0 @@ -43,3 +43,6 @@ What changed: - Now using AVX/AVX2/AVX-512 instructions in signal handler does not break their context. + +- sched_setscheduler(2) allows to change the priority if the policy is + equal to the value returned by sched_getscheduler(2). diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc index 71a1e868f..333786f44 100644 --- a/winsup/cygwin/sched.cc +++ b/winsup/cygwin/sched.cc @@ -399,8 +399,11 @@ int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param) { + if (policy == SCHED_FIFO) /* returned by sched_getscheduler. */ + return sched_setparam (pid, param); + /* on win32, you can't change the scheduler. Doh! */ - set_errno (ENOSYS); + set_errno (EINVAL); return -1; } -- 2.45.1