source: rtems/cpukit/posix/src/sched.c @ 412dbff6

4.104.114.84.95
Last change on this file since 412dbff6 was 412dbff6, checked in by Joel Sherrill <joel.sherrill@…>, on 04/05/07 at 21:17:27

2007-04-05 Joel Sherrill <joel@…>

  • posix/Makefile.am, posix/include/rtems/posix/time.h, posix/src/adjtime.c, posix/src/alarm.c, posix/src/clockgetres.c, posix/src/condtimedwait.c, posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/nanosleep.c, posix/src/posixtimespecabsolutetimeout.c, posix/src/pthread.c, posix/src/pthreadcreate.c, posix/src/pthreadsetschedparam.c, posix/src/ptimer1.c, posix/src/sched.c, posix/src/semtimedwait.c, posix/src/sigtimedwait.c, posix/src/ualarm.c, rtems/src/clocktodtoseconds.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodget.c, score/src/coretodgetuptime.c, score/src/coretodset.c, score/src/coretodtickle.c: Provide timespec manipulation routines in the SuperCore?. Use them everywhere possible. This lead to significant cleanup in the API routines and eliminated some of the same code from the POSIX API. At this point, the SuperCore? keeps time in POSIX timespec format properly from 1970. You just cannot set it before 1988 in keeping with RTEMS traditional behavior.
  • score/include/rtems/score/timespec.h, score/src/timespecaddto.c, score/src/timespecfromticks.c, score/src/timespecisvalid.c, score/src/timespeclessthan.c, score/src/timespecsubtract.c, score/src/timespectoticks.c: New files.
  • posix/src/posixintervaltotimespec.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c: Removed.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <sched.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/score/tod.h>
21#include <rtems/score/thread.h>
22#include <rtems/seterr.h>
23#include <rtems/posix/priority.h>
24#include <rtems/posix/time.h>
25
26/*PAGE
27 *
28 *  13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
29 *
30 */
31
32int sched_setparam(
33  pid_t                     pid,
34  const struct sched_param *param
35)
36{
37  rtems_set_errno_and_return_minus_one( ENOSYS );
38}
39
40/*PAGE
41 *
42 *  13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
43 */
44
45int sched_getparam(
46  pid_t                     pid,
47  const struct sched_param *param
48)
49{
50  rtems_set_errno_and_return_minus_one( ENOSYS );
51}
52
53/*PAGE
54 *
55 *  13.3.3 Set Scheduling Policy and Scheduling Parameters,
56 *         P1003.1b-1993, p. 254
57 */
58
59int sched_setscheduler(
60  pid_t                     pid,
61  int                       policy,
62  const struct sched_param *param
63)
64{
65  rtems_set_errno_and_return_minus_one( ENOSYS );
66}
67
68/*PAGE
69 *
70 *  13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
71 */
72
73int sched_getscheduler(
74  pid_t                     pid
75)
76{
77  rtems_set_errno_and_return_minus_one( ENOSYS );
78}
79
80/*PAGE
81 *
82 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
83 */
84
85int sched_get_priority_max(
86  int  policy
87)
88{
89  switch ( policy ) {
90    case SCHED_OTHER:
91    case SCHED_FIFO:
92    case SCHED_RR:
93    case SCHED_SPORADIC:
94      break;
95
96    default:
97      rtems_set_errno_and_return_minus_one( EINVAL );
98  }
99
100  return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
101}
102
103/*PAGE
104 *
105 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
106 */
107
108int sched_get_priority_min(
109  int  policy
110)
111{
112  switch ( policy ) {
113    case SCHED_OTHER:
114    case SCHED_FIFO:
115    case SCHED_RR:
116    case SCHED_SPORADIC:
117      break;
118
119    default:
120      rtems_set_errno_and_return_minus_one( EINVAL );
121  }
122
123  return POSIX_SCHEDULER_MINIMUM_PRIORITY;
124}
125
126/*PAGE
127 *
128 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
129 */
130
131int sched_rr_get_interval(
132  pid_t             pid,
133  struct timespec  *interval
134)
135{
136  /*
137   *  Only supported for the "calling process" (i.e. this node).
138   */
139
140  if ( pid && pid != getpid() )
141    rtems_set_errno_and_return_minus_one( ESRCH );
142
143  if ( !interval )
144    rtems_set_errno_and_return_minus_one( EINVAL );
145
146  _Timespec_From_ticks( _Thread_Ticks_per_timeslice, interval );
147  return 0;
148}
149
150/*PAGE
151 *
152 *  13.3.5 Yield Processor, P1003.1b-1993, p. 257
153 */
154
155int sched_yield( void )
156{
157  _Thread_Disable_dispatch();
158    _Thread_Yield_processor();
159  _Thread_Enable_dispatch();
160  return 0;
161}
Note: See TracBrowser for help on using the repository browser.