summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/sched_getprioritymax.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-14 11:13:22 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-14 11:58:03 +0200
commit6a631daeb87d41800212b494a560d62612982b23 (patch)
treef3fcdf8d6a63a62b821f7d094614567c57bf7e9b /cpukit/posix/src/sched_getprioritymax.c
parentposix: sched_get_priority_min() (diff)
downloadrtems-6a631daeb87d41800212b494a560d62612982b23.tar.bz2
posix: sched_get_priority_max()
Enable for all configurations since it pulls in no additional dependencies. Return value of the scheduler instance of the executing thread.
Diffstat (limited to 'cpukit/posix/src/sched_getprioritymax.c')
-rw-r--r--cpukit/posix/src/sched_getprioritymax.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cpukit/posix/src/sched_getprioritymax.c b/cpukit/posix/src/sched_getprioritymax.c
index cde9eb9466..94114e3b84 100644
--- a/cpukit/posix/src/sched_getprioritymax.c
+++ b/cpukit/posix/src/sched_getprioritymax.c
@@ -25,12 +25,14 @@
#include <rtems/system.h>
#include <rtems/seterr.h>
-#include <rtems/posix/priorityimpl.h>
+#include <rtems/score/schedulerimpl.h>
int sched_get_priority_max(
int policy
)
{
+ const Scheduler_Control *scheduler;
+
switch ( policy ) {
case SCHED_OTHER:
case SCHED_FIFO:
@@ -42,5 +44,11 @@ int sched_get_priority_max(
rtems_set_errno_and_return_minus_one( EINVAL );
}
- return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
+ scheduler = _Scheduler_Get_own( _Thread_Get_executing() );
+
+ if ( scheduler->maximum_priority > INT_MAX ) {
+ return INT_MAX;
+ }
+
+ return (int) scheduler->maximum_priority - 1;
}