summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/sched_getprioritymax.c
diff options
context:
space:
mode:
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;
}