source: rtems/c/src/exec/posix/src/sched.c @ b03ab630

4.104.114.84.95
Last change on this file since b03ab630 was b03ab630, checked in by Joel Sherrill <joel.sherrill@…>, on 08/15/96 at 18:57:07

sched_rr_get_interval: converted assert condition into a standard error
code and added check for a NULL interval being passed in.

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