source: rtems/cpukit/posix/src/sched.c @ 0061ef98

4.104.114.84.95
Last change on this file since 0061ef98 was 0061ef98, checked in by Joel Sherrill <joel.sherrill@…>, on 03/26/07 at 22:56:12

2007-03-26 Joel Sherrill <joel@…>

PR 1231/cpukit

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