Changeset 6a631da in rtems


Ignore:
Timestamp:
Jun 14, 2016, 9:13:22 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
d07f582
Parents:
ea02782a
git-author:
Sebastian Huber <sebastian.huber@…> (06/14/16 09:13:22)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/14/16 09:58:03)
Message:

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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/Makefile.am

    rea02782a r6a631da  
    208208EXTRA_DIST += src/README.mqueue
    209209
    210 libposix_a_SOURCES += src/sched_getparam.c src/sched_getprioritymax.c \
     210libposix_a_SOURCES += src/sched_getparam.c \
    211211    src/sched_getscheduler.c \
    212212    src/sched_rr_get_interval.c src/sched_setparam.c \
     
    215215
    216216libposix_a_SOURCES += src/sched_getprioritymin.c
     217libposix_a_SOURCES += src/sched_getprioritymax.c
    217218
    218219include $(srcdir)/preinstall.am
  • cpukit/posix/src/sched_getprioritymax.c

    rea02782a r6a631da  
    2626#include <rtems/system.h>
    2727#include <rtems/seterr.h>
    28 #include <rtems/posix/priorityimpl.h>
     28#include <rtems/score/schedulerimpl.h>
    2929
    3030int sched_get_priority_max(
     
    3232)
    3333{
     34  const Scheduler_Control *scheduler;
     35
    3436  switch ( policy ) {
    3537    case SCHED_OTHER:
     
    4345  }
    4446
    45   return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
     47  scheduler = _Scheduler_Get_own( _Thread_Get_executing() );
     48
     49  if ( scheduler->maximum_priority > INT_MAX ) {
     50    return INT_MAX;
     51  }
     52
     53  return (int) scheduler->maximum_priority - 1;
    4654}
  • testsuites/smptests/smpscheduler02/init.c

    rea02782a r6a631da  
    4444  rtems_test_assert(rtems_get_current_processor() == 1);
    4545  rtems_test_assert(sched_get_priority_min(SCHED_RR) == 1);
     46  rtems_test_assert(sched_get_priority_max(SCHED_RR) == 126);
    4647
    4748  sc = rtems_event_transient_send(main_task_id);
     
    135136
    136137  rtems_test_assert(sched_get_priority_min(SCHED_RR) == 1);
     138  rtems_test_assert(sched_get_priority_max(SCHED_RR) == 254);
    137139
    138140  if (cpu_count > 1) {
     
    216218#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 64
    217219
    218 #define CONFIGURE_MAXIMUM_PRIORITY 255
    219 
    220220#define CONFIGURE_SCHEDULER_PRIORITY_SMP
    221221#define CONFIGURE_SCHEDULER_SIMPLE_SMP
     
    223223#include <rtems/scheduler.h>
    224224
    225 RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(a, CONFIGURE_MAXIMUM_PRIORITY + 1);
    226 
    227 RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(b, CONFIGURE_MAXIMUM_PRIORITY + 1);
     225RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(a, 256);
     226
     227RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP(b, 128);
    228228
    229229RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(c);
Note: See TracChangeset for help on using the changeset viewer.