[Bug 382] New: RTT does not provide means to check scheduler/priority combos

For more information about this bug, visit
A new bug was added:
Summary: RTT does not provide means to check scheduler/priority
combos
Product: RTT
Version: 1.1.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Operating System Abstraction - Portability
AssignedTo: orocos-dev [..] ...
ReportedBy: peter [dot] soetens [..] ...

When one creates an activity object, it requires a scheduler and a priority.
Different OS'es or schedulers accept different priority levels. However, Orocos
has only the constants ORO_SCHED_RT ORO_SCHED_OTHER and HighestPriority and
LowestPriority. We're lacking some functions to check:

1. if a given scheduler is valid to use (for example SCHED_FIFO is only valid
if the user is root)
2. if a given priority is valid with a given scheduler.

Both functions can indicate validity and correct the given arguments (bounds
checking).

The following functions obey this contract:
namespace RTT { namespace OS {
/**
* Check if the scheduler is a valid type in the current process
* and adapt to a valid value.
* @return true if \a sched_type made sense, false if a
* correction was applied.
*/
bool CheckScheduler(int& sched_type);

/**
* Check if the scheduler type and priority match and
* adapt to a valid value. If \a sched_type is unknown
* a default is choosen. If \a priority is invalid within
* \a sched_type, a default is choosen.
* @return true if the arguments made sense, false if a
* correction was applied.
*/
bool CheckPriority(int& sched_type, int& priority);
}}

With the fosi (internal OS) C functions:
int rtos_task_check_scheduler(int* sched);
int rtos_task_check_priority(int* sched, int* prio);

This functionality is required by all thread/activity related classes to check
user arguments.

[Bug 382] RTT does not provide means to check scheduler/priority

For more information about this bug, visit

peter [dot] soetens [..] ... changed:

What |Removed |Added
---------------------------------------------------------------------------
Target Milestone|--- |1.2.0
Resolution| |FIXED
Status|NEW |RESOLVED

------- Comment #1 from peter [dot] soetens [..] ... 2007-04-25 15:28

$ svn ci tests/taskthread_test.cpp src/os/ -m"Fix bug #382: RTT does not
provide means to check scheduler/priority combos.
> bool CheckScheduler(int& sched_type)
> bool CheckPriority(int& sched_type, int& priority);
> int rtos_task_check_scheduler(int* sched);
> int rtos_task_check_priority(int* sched, int* prio);
> For all OS'es (ecos untested).
>
> "
Sending src/os/MainThread.cpp
Sending src/os/PeriodicThread.cpp
Sending src/os/SingleThread.cpp
Adding src/os/ecos/fosi_internal.cpp
Deleting src/os/ecos/fosi_internal.hpp
Deleting src/os/fosi_internal_interface.h
Adding src/os/fosi_internal_interface.hpp
Adding src/os/gnulinux/fosi_internal.cpp
Deleting src/os/gnulinux/fosi_internal.hpp
Adding src/os/lxrt/fosi_internal.cpp
Deleting src/os/lxrt/fosi_internal.hpp
Sending src/os/threads.cpp
Sending src/os/threads.hpp
Adding src/os/xenomai/fosi_internal.cpp
Deleting src/os/xenomai/fosi_internal.hpp
Sending tests/taskthread_test.cpp
Transmitting file data ...........
Committed revision 6948.