Xenomai  3.1-devel
sched.h
1 /*
2  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18 #ifndef _COBALT_UAPI_SCHED_H
19 #define _COBALT_UAPI_SCHED_H
20 
21 #define SCHED_COBALT 42
22 #define SCHED_WEAK 43
23 
24 /* for internal use */
25 #define __SCHED_CURRENT 44
26 
27 #ifndef SCHED_SPORADIC
28 #define SCHED_SPORADIC 10
29 #define sched_ss_low_priority sched_u.ss.__sched_low_priority
30 #define sched_ss_repl_period sched_u.ss.__sched_repl_period
31 #define sched_ss_init_budget sched_u.ss.__sched_init_budget
32 #define sched_ss_max_repl sched_u.ss.__sched_max_repl
33 #endif /* !SCHED_SPORADIC */
34 
35 struct __sched_ss_param {
36  int __sched_low_priority;
37  struct timespec __sched_repl_period;
38  struct timespec __sched_init_budget;
39  int __sched_max_repl;
40 };
41 
42 #define sched_rr_quantum sched_u.rr.__sched_rr_quantum
43 
44 struct __sched_rr_param {
45  struct timespec __sched_rr_quantum;
46 };
47 
48 #ifndef SCHED_TP
49 #define SCHED_TP 11
50 #define sched_tp_partition sched_u.tp.__sched_partition
51 #endif /* !SCHED_TP */
52 
53 struct __sched_tp_param {
54  int __sched_partition;
55 };
56 
57 struct sched_tp_window {
58  struct timespec offset;
59  struct timespec duration;
60  int ptid;
61 };
62 
63 enum {
64  sched_tp_install,
65  sched_tp_uninstall,
66  sched_tp_start,
67  sched_tp_stop,
68 };
69 
70 struct __sched_config_tp {
71  int op;
72  int nr_windows;
73  struct sched_tp_window windows[0];
74 };
75 
76 #define sched_tp_confsz(nr_win) \
77  (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))
78 
79 #ifndef SCHED_QUOTA
80 #define SCHED_QUOTA 12
81 #define sched_quota_group sched_u.quota.__sched_group
82 #endif /* !SCHED_QUOTA */
83 
84 struct __sched_quota_param {
85  int __sched_group;
86 };
87 
88 enum {
89  sched_quota_add,
90  sched_quota_remove,
91  sched_quota_force_remove,
92  sched_quota_set,
93  sched_quota_get,
94 };
95 
96 struct __sched_config_quota {
97  int op;
98  union {
99  struct {
100  int pshared;
101  } add;
102  struct {
103  int tgid;
104  } remove;
105  struct {
106  int tgid;
107  int quota;
108  int quota_peak;
109  } set;
110  struct {
111  int tgid;
112  } get;
113  };
114  struct __sched_quota_info {
115  int tgid;
116  int quota;
117  int quota_peak;
118  int quota_sum;
119  } info;
120 };
121 
122 #define sched_quota_confsz() sizeof(struct __sched_config_quota)
123 
124 struct sched_param_ex {
125  int sched_priority;
126  union {
127  struct __sched_ss_param ss;
128  struct __sched_rr_param rr;
129  struct __sched_tp_param tp;
130  struct __sched_quota_param quota;
131  } sched_u;
132 };
133 
134 union sched_config {
135  struct __sched_config_tp tp;
136  struct __sched_config_quota quota;
137 };
138 
139 #endif /* !_COBALT_UAPI_SCHED_H */