[7f72217e] | 1 | /* |
---|
[eb5a7e07] | 2 | * $Id$ |
---|
[5e9b32b] | 3 | */ |
---|
| 4 | |
---|
| 5 | #include <sched.h> |
---|
[f4719d5a] | 6 | |
---|
| 7 | #include <rtems/system.h> |
---|
[5e9b32b] | 8 | #include <rtems/score/tod.h> |
---|
| 9 | #include <rtems/score/thread.h> |
---|
| 10 | #include <rtems/posix/priority.h> |
---|
| 11 | |
---|
| 12 | /*PAGE |
---|
| 13 | * |
---|
| 14 | * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252 |
---|
| 15 | * |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | int sched_setparam( |
---|
| 19 | pid_t pid, |
---|
| 20 | const struct sched_param *param |
---|
| 21 | ) |
---|
| 22 | { |
---|
| 23 | return POSIX_NOT_IMPLEMENTED(); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | /*PAGE |
---|
| 27 | * |
---|
| 28 | * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253 |
---|
| 29 | */ |
---|
| 30 | |
---|
| 31 | int sched_getparam( |
---|
| 32 | pid_t pid, |
---|
| 33 | const struct sched_param *param |
---|
| 34 | ) |
---|
| 35 | { |
---|
| 36 | return POSIX_NOT_IMPLEMENTED(); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | /*PAGE |
---|
| 40 | * |
---|
| 41 | * 13.3.3 Set Scheduling Policy and Scheduling Parameters, |
---|
| 42 | * P1003.1b-1993, p. 254 |
---|
| 43 | */ |
---|
| 44 | |
---|
| 45 | int sched_setscheduler( |
---|
| 46 | pid_t pid, |
---|
| 47 | int policy, |
---|
| 48 | const struct sched_param *param |
---|
| 49 | ) |
---|
| 50 | { |
---|
| 51 | return POSIX_NOT_IMPLEMENTED(); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | /*PAGE |
---|
| 55 | * |
---|
| 56 | * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256 |
---|
| 57 | */ |
---|
| 58 | |
---|
| 59 | int sched_getscheduler( |
---|
| 60 | pid_t pid |
---|
| 61 | ) |
---|
| 62 | { |
---|
| 63 | return POSIX_NOT_IMPLEMENTED(); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | /*PAGE |
---|
| 67 | * |
---|
| 68 | * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258 |
---|
| 69 | */ |
---|
| 70 | |
---|
| 71 | int sched_get_priority_max( |
---|
| 72 | int policy |
---|
| 73 | ) |
---|
| 74 | { |
---|
| 75 | /* XXX error check the policy */ |
---|
| 76 | return POSIX_SCHEDULER_MAXIMUM_PRIORITY; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | /*PAGE |
---|
| 80 | * |
---|
| 81 | * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258 |
---|
| 82 | */ |
---|
| 83 | |
---|
| 84 | int sched_get_priority_min( |
---|
| 85 | int policy |
---|
| 86 | ) |
---|
| 87 | { |
---|
| 88 | /* XXX error check the policy */ |
---|
| 89 | return POSIX_SCHEDULER_MINIMUM_PRIORITY; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | /*PAGE |
---|
| 93 | * |
---|
| 94 | * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258 |
---|
| 95 | */ |
---|
| 96 | |
---|
| 97 | int sched_rr_get_interval( |
---|
| 98 | pid_t pid, |
---|
| 99 | struct timespec *interval |
---|
| 100 | ) |
---|
| 101 | { |
---|
| 102 | time_t us_per_quantum; |
---|
| 103 | |
---|
| 104 | /* XXX eventually should support different time quantums per thread */ |
---|
| 105 | |
---|
| 106 | /* XXX should get for errors? (bad pid) */ |
---|
| 107 | |
---|
| 108 | us_per_quantum = _TOD_Microseconds_per_tick * _Thread_Ticks_per_timeslice; |
---|
| 109 | |
---|
| 110 | interval->tv_sec = us_per_quantum / TOD_MICROSECONDS_PER_SECOND; |
---|
| 111 | interval->tv_nsec = (us_per_quantum % TOD_MICROSECONDS_PER_SECOND) * 1000; |
---|
| 112 | return 0; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | /*PAGE |
---|
| 116 | * |
---|
| 117 | * 13.3.5 Yield Processor, P1003.1b-1993, p. 257 |
---|
| 118 | */ |
---|
| 119 | |
---|
| 120 | int sched_yield( void ) |
---|
| 121 | { |
---|
| 122 | _Thread_Yield_processor(); |
---|
| 123 | return 0; |
---|
| 124 | } |
---|