sched/getprioritymax: handle invaild policy as posix style

modify the return value according to posix standard
------------
SCHED_GET_PRIORITY_MAX(2)

NAME
       sched_get_priority_max, sched_get_priority_min  - get static priority range

RETURN VALUE
       On success, sched_get_priority_max() and sched_get_priority_min() return the
                   maximum/minimum priority value for the named scheduling policy.
       On error, -1 is returned, and errno is set appropriately.

ERRORS
       EINVAL The argument policy does not identify a defined scheduling policy.

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-11-01 00:50:33 +08:00 committed by Xiang Xiao
parent eeb4d41f55
commit 1550747400

View file

@ -52,6 +52,11 @@
int sched_get_priority_max(int policy)
{
DEBUGASSERT(policy >= SCHED_FIFO && policy <= SCHED_OTHER);
if (policy < SCHED_FIFO || policy > SCHED_OTHER)
{
set_errno(EINVAL);
return ERROR;
}
return SCHED_PRIORITY_MAX;
}