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().

Fixes: 9a08b2c02e ("* sched.cc: New file.  Implement sched*.")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
(cherry picked from commit 522f3e921a)
This commit is contained in:
Christian Franke 2024-11-27 16:39:37 +01:00 committed by Corinna Vinschen
parent d06ba04550
commit 96d729bc00
2 changed files with 7 additions and 1 deletions

View File

@ -45,3 +45,6 @@ Fixes:
- Fix segfault in sigtimedwait() when using timeout. - Fix segfault in sigtimedwait() when using timeout.
Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256762.html Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256762.html
- sched_setscheduler(2) allows to change the priority if the policy is
equal to the value returned by sched_getscheduler(2).

View File

@ -402,8 +402,11 @@ int
sched_setscheduler (pid_t pid, int policy, sched_setscheduler (pid_t pid, int policy,
const struct sched_param *param) 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! */ /* on win32, you can't change the scheduler. Doh! */
set_errno (ENOSYS); set_errno (EINVAL);
return -1; return -1;
} }