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>
This commit is contained in:
Christian Franke 2024-11-27 16:39:37 +01:00 committed by Corinna Vinschen
parent 153b51ee08
commit 522f3e921a
2 changed files with 7 additions and 1 deletions

View File

@ -45,3 +45,6 @@ Fixes:
- Fix segfault in sigtimedwait() when using timeout.
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,
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;
}