mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
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:
parent
eeb4d41f55
commit
1550747400
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue