2 * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef _XENO_POSIX_SCHED_H
20 #define _XENO_POSIX_SCHED_H
22 #if defined(__KERNEL__) || defined(__XENO_SIM__)
24 #include <nucleus/xenomai.h>
27 #include <linux/sched.h>
28 #endif /* __KERNEL__ */
31 #include <posix_overrides.h>
34 #endif /* __XENO_SIM__ */
44 int sched_yield(void);
46 int sched_get_priority_min(int policy
);
48 int sched_get_priority_max(int policy
);
50 int sched_rr_get_interval(int pid
, struct timespec
*interval
);
56 #else /* !(__KERNEL__ || __XENO_SIM__) */
58 #pragma GCC system_header
60 #include_next <sched.h>
62 int __real_sched_yield(void);
64 #endif /* !(__KERNEL__ || __XENO_SIM__) */
66 #ifndef __sched_extensions_defined
67 #define __sched_extensions_defined
69 #ifndef SCHED_SPORADIC
70 #define SCHED_SPORADIC 10
71 #define sched_ss_low_priority sched_u.ss.__sched_low_priority
72 #define sched_ss_repl_period sched_u.ss.__sched_repl_period
73 #define sched_ss_init_budget sched_u.ss.__sched_init_budget
74 #define sched_ss_max_repl sched_u.ss.__sched_max_repl
75 #endif /* !SCHED_SPORADIC */
77 struct __sched_ss_param
{
78 int __sched_low_priority
;
79 struct timespec __sched_repl_period
;
80 struct timespec __sched_init_budget
;
86 #define sched_tp_partition sched_u.tp.__sched_partition
87 #endif /* !SCHED_TP */
89 struct __sched_tp_param
{
90 int __sched_partition
;
93 struct sched_param_ex
{
96 struct __sched_ss_param ss
;
97 struct __sched_tp_param tp
;
101 struct sched_tp_window
{
102 struct timespec offset
;
103 struct timespec duration
;
107 struct __sched_config_tp
{
109 struct sched_tp_window windows
[];
113 struct __sched_config_tp tp
;
116 #define sched_tp_confsz(nr_win) \
117 (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))
123 int sched_setconfig_np(int cpu
, int policy
,
124 union sched_config
*config
, size_t len
);
130 #endif /* __sched_extensions_defined */