mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 02:36:11 +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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user