4.104.115
Last change
on this file since 69ca55c0 was
2212a2ad,
checked in by Joel Sherrill <joel.sherrill@…>, on 06/24/09 at 06:38:52
|
2009-06-24 Joel Sherrill <joel.sherrill@…>
- posix/Makefile.am, posix/include/rtems/posix/priority.h,
posix/include/rtems/posix/pthread.h,
posix/inline/rtems/posix/priority.inl, posix/src/killinfo.c,
posix/src/pthread.c, posix/src/pthreadcreate.c,
posix/src/pthreadsetschedparam.c: Various modifications to improve
binary code coverage analysis. Some of these are to mark code as
debug only. Some are to break conditional expressions into multiple
lines. Some are to move inline methods that are not time critical
into subroutines to make them easier to test. Inlining them multiple
times means that their logic paths are spread across multiple
methods. This explodes the test cases required.
- posix/src/psxpriorityisvalid.c, posix/src/psxtransschedparam.c: New files.
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | /* COPYRIGHT (c) 1989-2009. |
---|
2 | * On-Line Applications Research Corporation (OAR). |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.com/license/LICENSE. |
---|
7 | * |
---|
8 | * $Id$ |
---|
9 | */ |
---|
10 | |
---|
11 | #if HAVE_CONFIG_H |
---|
12 | #include "config.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include <pthread.h> |
---|
16 | #include <errno.h> |
---|
17 | |
---|
18 | #include <rtems/system.h> |
---|
19 | #include <rtems/posix/pthread.h> |
---|
20 | #include <rtems/posix/priority.h> |
---|
21 | #include <rtems/posix/time.h> |
---|
22 | |
---|
23 | int _POSIX_Thread_Translate_sched_param( |
---|
24 | int policy, |
---|
25 | struct sched_param *param, |
---|
26 | Thread_CPU_budget_algorithms *budget_algorithm, |
---|
27 | Thread_CPU_budget_algorithm_callout *budget_callout |
---|
28 | ) |
---|
29 | { |
---|
30 | if ( !_POSIX_Priority_Is_valid( param->sched_priority ) ) |
---|
31 | return EINVAL; |
---|
32 | |
---|
33 | *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; |
---|
34 | *budget_callout = NULL; |
---|
35 | |
---|
36 | switch ( policy ) { |
---|
37 | case SCHED_OTHER: |
---|
38 | *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; |
---|
39 | break; |
---|
40 | |
---|
41 | case SCHED_FIFO: |
---|
42 | *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; |
---|
43 | break; |
---|
44 | |
---|
45 | case SCHED_RR: |
---|
46 | *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE; |
---|
47 | break; |
---|
48 | |
---|
49 | case SCHED_SPORADIC: |
---|
50 | *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT; |
---|
51 | *budget_callout = _POSIX_Threads_Sporadic_budget_callout; |
---|
52 | |
---|
53 | if ( _Timespec_To_ticks( ¶m->ss_replenish_period ) < |
---|
54 | _Timespec_To_ticks( ¶m->ss_initial_budget ) ) |
---|
55 | return EINVAL; |
---|
56 | |
---|
57 | if ( !_POSIX_Priority_Is_valid( param->ss_low_priority ) ) |
---|
58 | return EINVAL; |
---|
59 | break; |
---|
60 | |
---|
61 | default: |
---|
62 | return EINVAL; |
---|
63 | } |
---|
64 | return 0; |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.