diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-14 11:13:22 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-14 11:58:03 +0200 |
commit | 6a631daeb87d41800212b494a560d62612982b23 (patch) | |
tree | f3fcdf8d6a63a62b821f7d094614567c57bf7e9b /cpukit | |
parent | posix: sched_get_priority_min() (diff) | |
download | rtems-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')
-rw-r--r-- | cpukit/posix/Makefile.am | 3 | ||||
-rw-r--r-- | cpukit/posix/src/sched_getprioritymax.c | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index a119bd0598..873ad11226 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -207,13 +207,14 @@ libposix_a_SOURCES += src/psxnametoid.c EXTRA_DIST += src/README.mqueue -libposix_a_SOURCES += src/sched_getparam.c src/sched_getprioritymax.c \ +libposix_a_SOURCES += src/sched_getparam.c \ src/sched_getscheduler.c \ src/sched_rr_get_interval.c src/sched_setparam.c \ src/sched_setscheduler.c src/sched_yield.c endif libposix_a_SOURCES += src/sched_getprioritymin.c +libposix_a_SOURCES += src/sched_getprioritymax.c include $(srcdir)/preinstall.am include $(top_srcdir)/automake/local.am 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; } |