source: rtems/cpukit/posix/src/sched.c @ 874297f3

4.104.114.84.95
Last change on this file since 874297f3 was 874297f3, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/16/04 at 10:01:03

Remove stray white spaces.

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[7f72217e]1/*
[eb5a7e07]2 *  $Id$
[5e9b32b]3 */
4
[f42b726]5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
[5e7b6272]9#include <assert.h>
[5e9b32b]10#include <sched.h>
[24adc5b]11#include <errno.h>
[f4719d5a]12
13#include <rtems/system.h>
[5e9b32b]14#include <rtems/score/tod.h>
15#include <rtems/score/thread.h>
[188c82b]16#include <rtems/seterr.h>
[5e9b32b]17#include <rtems/posix/priority.h>
[24adc5b]18#include <rtems/posix/time.h>
[5e9b32b]19
20/*PAGE
21 *
22 *  13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
23 *
24 */
25
26int sched_setparam(
27  pid_t                     pid,
28  const struct sched_param *param
29)
30{
[e180a77e]31  rtems_set_errno_and_return_minus_one( ENOSYS );
[5e9b32b]32}
33
34/*PAGE
35 *
36 *  13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
37 */
38
39int sched_getparam(
40  pid_t                     pid,
41  const struct sched_param *param
42)
43{
[e180a77e]44  rtems_set_errno_and_return_minus_one( ENOSYS );
[5e9b32b]45}
46
47/*PAGE
48 *
[874297f3]49 *  13.3.3 Set Scheduling Policy and Scheduling Parameters,
[5e9b32b]50 *         P1003.1b-1993, p. 254
51 */
52
53int sched_setscheduler(
54  pid_t                     pid,
55  int                       policy,
56  const struct sched_param *param
57)
58{
[e180a77e]59  rtems_set_errno_and_return_minus_one( ENOSYS );
[5e9b32b]60}
61
62/*PAGE
63 *
64 *  13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
65 */
66
67int sched_getscheduler(
68  pid_t                     pid
69)
70{
[e180a77e]71  rtems_set_errno_and_return_minus_one( ENOSYS );
[5e9b32b]72}
73
74/*PAGE
75 *
76 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
77 */
78
79int sched_get_priority_max(
80  int  policy
81)
82{
[c48e0ee]83  switch ( policy ) {
84    case SCHED_OTHER:
85    case SCHED_FIFO:
86    case SCHED_RR:
87    case SCHED_SPORADIC:
88      break;
[874297f3]89
[c48e0ee]90    default:
[e180a77e]91      rtems_set_errno_and_return_minus_one( EINVAL );
[c48e0ee]92  }
93
[5e9b32b]94  return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
95}
96
97/*PAGE
98 *
99 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
100 */
101
102int sched_get_priority_min(
103  int  policy
104)
105{
[c48e0ee]106  switch ( policy ) {
107    case SCHED_OTHER:
108    case SCHED_FIFO:
109    case SCHED_RR:
110    case SCHED_SPORADIC:
111      break;
[874297f3]112
[c48e0ee]113    default:
[e180a77e]114      rtems_set_errno_and_return_minus_one( EINVAL );
[c48e0ee]115  }
116
[5e9b32b]117  return POSIX_SCHEDULER_MINIMUM_PRIORITY;
118}
119
120/*PAGE
121 *
122 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
123 */
124
125int sched_rr_get_interval(
126  pid_t             pid,
127  struct timespec  *interval
128)
129{
[c48e0ee]130  /* XXX do we need to support different time quantums per thread */
[5e9b32b]131
[c48e0ee]132  /*
133   *  Only supported for the "calling process" (i.e. this node).
134   */
[5e9b32b]135
[ed1a0e51]136  if ( pid && pid != getpid() )
[e180a77e]137    rtems_set_errno_and_return_minus_one( ESRCH );
[b03ab630]138
139  if ( !interval )
[e180a77e]140    rtems_set_errno_and_return_minus_one( EINVAL );
[c238a218]141
[c48e0ee]142  _POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
[5e9b32b]143  return 0;
144}
145
146/*PAGE
147 *
148 *  13.3.5 Yield Processor, P1003.1b-1993, p. 257
149 */
150
151int sched_yield( void )
152{
[8699a70]153  _Thread_Disable_dispatch();
154    _Thread_Yield_processor();
155  _Thread_Enable_dispatch();
[5e9b32b]156  return 0;
157}
Note: See TracBrowser for help on using the repository browser.