summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/sched.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-06-04 16:15:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-06-04 16:15:59 +0000
commitc48e0ee2b8fd565f8bcb45074a3d33cb7ec1428f (patch)
tree1d3d3662f2483e73e024142fa0b1a496571c1c82 /cpukit/posix/src/sched.c
parentadded scheduling policy and parameter information (diff)
downloadrtems-c48e0ee2b8fd565f8bcb45074a3d33cb7ec1428f.tar.bz2
added interpretation of scheduling policy and parameter information to
pthread_create initial implementation of get/set id routines better argument checking on scheduler functions.
Diffstat (limited to 'cpukit/posix/src/sched.c')
-rw-r--r--cpukit/posix/src/sched.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/cpukit/posix/src/sched.c b/cpukit/posix/src/sched.c
index 1a9a9fe38b..2cee1fc07d 100644
--- a/cpukit/posix/src/sched.c
+++ b/cpukit/posix/src/sched.c
@@ -85,7 +85,18 @@ int sched_get_priority_max(
int policy
)
{
- /* XXX error check the policy */
+ switch ( policy ) {
+ case SCHED_OTHER:
+ case SCHED_FIFO:
+ case SCHED_RR:
+ case SCHED_SPORADIC:
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
}
@@ -98,7 +109,18 @@ int sched_get_priority_min(
int policy
)
{
- /* XXX error check the policy */
+ switch ( policy ) {
+ case SCHED_OTHER:
+ case SCHED_FIFO:
+ case SCHED_RR:
+ case SCHED_SPORADIC:
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
return POSIX_SCHEDULER_MINIMUM_PRIORITY;
}
@@ -114,18 +136,16 @@ int sched_rr_get_interval(
{
time_t us_per_quantum;
- /* XXX eventually should support different time quantums per thread */
+ /* XXX do we need to support different time quantums per thread */
- /* XXX should get for errors? (bad pid) */
+ /*
+ * Only supported for the "calling process" (i.e. this node).
+ */
- /* XXX some of the time routines also convert usecs to a timespec -- */
- /* XXX should this be a common routine? */
+ assert( pid == getpid() );
- us_per_quantum = _TOD_Microseconds_per_tick * _Thread_Ticks_per_timeslice;
- interval->tv_sec = us_per_quantum / TOD_MICROSECONDS_PER_SECOND;
- interval->tv_nsec = (us_per_quantum % TOD_MICROSECONDS_PER_SECOND) *
- TOD_NANOSECONDS_PER_MICROSECOND;
+ _POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
return 0;
}