1 |
27 |
unneback |
#ifndef CYGONCE_ISO_SCHED_H
|
2 |
|
|
#define CYGONCE_ISO_SCHED_H
|
3 |
|
|
/*========================================================================
|
4 |
|
|
//
|
5 |
|
|
// sched.h
|
6 |
|
|
//
|
7 |
|
|
// POSIX scheduler functions
|
8 |
|
|
//
|
9 |
|
|
//========================================================================
|
10 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
20 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License along
|
25 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
29 |
|
|
// or inline functions from this file, or you compile this file and link it
|
30 |
|
|
// with other works to produce a work based on this file, this file does not
|
31 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
32 |
|
|
// License. However the source code for this file must still be made available
|
33 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
36 |
|
|
// this file might be covered by the GNU General Public License.
|
37 |
|
|
//
|
38 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
39 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): jlarmour
|
46 |
|
|
// Contributors:
|
47 |
|
|
// Date: 2000-04-14
|
48 |
|
|
// Purpose: This file provides the scheduler macros, types and functions
|
49 |
|
|
// required by POSIX 1003.1.
|
50 |
|
|
// Description: The real contents of this file get set from the
|
51 |
|
|
// configuration (set by the implementation)
|
52 |
|
|
// Usage: #include <sched.h>
|
53 |
|
|
//
|
54 |
|
|
//####DESCRIPTIONEND####
|
55 |
|
|
//
|
56 |
|
|
//======================================================================
|
57 |
|
|
*/
|
58 |
|
|
|
59 |
|
|
/* CONFIGURATION */
|
60 |
|
|
|
61 |
|
|
#include <pkgconf/isoinfra.h> /* Configuration header */
|
62 |
|
|
|
63 |
|
|
/* INCLUDES */
|
64 |
|
|
|
65 |
|
|
#include <time.h>
|
66 |
|
|
|
67 |
|
|
#if CYGINT_ISO_SCHED_IMPL
|
68 |
|
|
# ifdef CYGBLD_ISO_SCHED_IMPL_HEADER
|
69 |
|
|
# include CYGBLD_ISO_SCHED_IMPL_HEADER
|
70 |
|
|
# else
|
71 |
|
|
|
72 |
|
|
//-----------------------------------------------------------------------------
|
73 |
|
|
// Scheduling Policys
|
74 |
|
|
|
75 |
|
|
#define SCHED_OTHER 1
|
76 |
|
|
#define SCHED_FIFO 2
|
77 |
|
|
#define SCHED_RR 3
|
78 |
|
|
|
79 |
|
|
//-----------------------------------------------------------------------------
|
80 |
|
|
//Process scheduling functions.
|
81 |
|
|
|
82 |
|
|
#ifdef __cplusplus
|
83 |
|
|
extern "C" {
|
84 |
|
|
#endif
|
85 |
|
|
|
86 |
|
|
// Set scheduling parameters for given process.
|
87 |
|
|
extern int sched_setparam (pid_t pid, const struct sched_param *param);
|
88 |
|
|
|
89 |
|
|
// Get scheduling parameters for given process.
|
90 |
|
|
extern int sched_getparam (pid_t pid, struct sched_param *param);
|
91 |
|
|
|
92 |
|
|
// Set scheduling policy and/or parameters for given process.
|
93 |
|
|
extern int sched_setscheduler (pid_t pid,
|
94 |
|
|
int policy,
|
95 |
|
|
const struct sched_param *param);
|
96 |
|
|
|
97 |
|
|
// Get scheduling policy for given process.
|
98 |
|
|
extern int sched_getscheduler (pid_t pid);
|
99 |
|
|
|
100 |
|
|
// Force current thread to relinquish the processor.
|
101 |
|
|
extern int sched_yield (void);
|
102 |
|
|
|
103 |
|
|
//-----------------------------------------------------------------------------
|
104 |
|
|
// Scheduler parameter limits.
|
105 |
|
|
|
106 |
|
|
// Get maximum priority value for a policy.
|
107 |
|
|
extern int sched_get_priority_max (int policy);
|
108 |
|
|
|
109 |
|
|
// Get minimum priority value for a policy.
|
110 |
|
|
extern int sched_get_priority_min (int policy);
|
111 |
|
|
|
112 |
|
|
// Get the SCHED_RR interval for the given process.
|
113 |
|
|
extern int sched_rr_get_interval (pid_t pid, struct timespec *t);
|
114 |
|
|
|
115 |
|
|
#ifdef __cplusplus
|
116 |
|
|
} /* extern "C" */
|
117 |
|
|
#endif
|
118 |
|
|
|
119 |
|
|
#endif
|
120 |
|
|
|
121 |
|
|
#endif /* if CYGINT_ISO_SCHED_IMPL */
|
122 |
|
|
|
123 |
|
|
#endif /* CYGONCE_ISO_SCHED_H multiple inclusion protection */
|
124 |
|
|
|
125 |
|
|
/* EOF sched.h */
|