Files
AnyPS5/core/libs/tests/GuestSchedPriority.cpp
T
Scott SchusterandClaude Opus 5.5 570aac4677 fix(libkernel): accept SCHED_OTHER in sched_get_priority_max/min
SDL queries the SCHED_OTHER range before it sets a thread priority. It gets
the same 256 to 767 range as SCHED_FIFO and SCHED_RR, which
pthread_setschedparam applies regardless of policy. The console's answer is
unverified and recorded in TechnicalDebt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:47:11 -05:00

20 lines
687 B
C++

#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdlib>
#include <stdexcept>
extern "C" {
int APS5_VABI sched_get_priority_max_nid_postfix(int policy);
int APS5_VABI sched_get_priority_min_nid_postfix(int policy);
}
static void Require(bool value) { if (!value) std::abort(); }
static bool Rejects(int policy) {
try { sched_get_priority_max_nid_postfix(policy); } catch (const std::invalid_argument&) { return true; }
return false;
}
int main() {
for (int policy : {1, 2, 3}) {
Require(sched_get_priority_max_nid_postfix(policy) == 256);
Require(sched_get_priority_min_nid_postfix(policy) == 767);
}
Require(Rejects(0) && Rejects(4));
}