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