00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _XENO_POSIX_SCHED_H
00020 #define _XENO_POSIX_SCHED_H
00021
00022 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00023
00024 #include <nucleus/xenomai.h>
00025
00026 #ifdef __KERNEL__
00027 #include <linux/sched.h>
00028 #endif
00029
00030 #ifdef __XENO_SIM__
00031 #include <posix_overrides.h>
00032 #define SCHED_FIFO 1
00033 #define SCHED_RR 2
00034 #endif
00035
00036 #define SCHED_OTHER 0
00037
00038 struct timespec;
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044 int sched_yield(void);
00045
00046 int sched_get_priority_min(int policy);
00047
00048 int sched_get_priority_max(int policy);
00049
00050 int sched_rr_get_interval(int pid, struct timespec *interval);
00051
00052 #ifdef __cplusplus
00053 }
00054 #endif
00055
00056 #else
00057
00058 #include_next <sched.h>
00059
00060 int __real_sched_yield(void);
00061
00062 #endif
00063
00064 #ifndef __sched_extensions_defined
00065 #define __sched_extensions_defined
00066
00067 #ifndef SCHED_SPORADIC
00068 #define SCHED_SPORADIC 10
00069 #define sched_ss_low_priority sched_u.ss.__sched_low_priority
00070 #define sched_ss_repl_period sched_u.ss.__sched_repl_period
00071 #define sched_ss_init_budget sched_u.ss.__sched_init_budget
00072 #define sched_ss_max_repl sched_u.ss.__sched_max_repl
00073 #endif
00074
00075 struct __sched_ss_param {
00076 int __sched_low_priority;
00077 struct timespec __sched_repl_period;
00078 struct timespec __sched_init_budget;
00079 int __sched_max_repl;
00080 };
00081
00082 #ifndef SCHED_TP
00083 #define SCHED_TP 11
00084 #define sched_tp_partition sched_u.tp.__sched_partition
00085 #endif
00086
00087 struct __sched_tp_param {
00088 int __sched_partition;
00089 };
00090
00091 struct sched_param_ex {
00092 int sched_priority;
00093 union {
00094 struct __sched_ss_param ss;
00095 struct __sched_tp_param tp;
00096 } sched_u;
00097 };
00098
00099 struct sched_tp_window {
00100 struct timespec offset;
00101 struct timespec duration;
00102 int ptid;
00103 };
00104
00105 struct __sched_config_tp {
00106 int nr_windows;
00107 struct sched_tp_window windows[0];
00108 };
00109
00110 union sched_config {
00111 struct __sched_config_tp tp;
00112 };
00113
00114 #define sched_tp_confsz(nr_win) \
00115 (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))
00116
00117 #ifdef __cplusplus
00118 extern "C" {
00119 #endif
00120
00121 int sched_setconfig_np(int cpu, int policy,
00122 union sched_config *config, size_t len);
00123
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127
00128 #endif
00129
00130 #endif