Xenomai  3.0.8
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 #ifndef SCHED_SPORADIC
25 #define SCHED_SPORADIC 10
26 #define sched_ss_low_priority sched_u.ss.__sched_low_priority
27 #define sched_ss_repl_period sched_u.ss.__sched_repl_period
28 #define sched_ss_init_budget sched_u.ss.__sched_init_budget
29 #define sched_ss_max_repl sched_u.ss.__sched_max_repl
30 #endif /* !SCHED_SPORADIC */
31 
32 struct __sched_ss_param {
33  int __sched_low_priority;
34  struct timespec __sched_repl_period;
35  struct timespec __sched_init_budget;
36  int __sched_max_repl;
37 };
38 
39 #define sched_rr_quantum sched_u.rr.__sched_rr_quantum
40 
41 struct __sched_rr_param {
42  struct timespec __sched_rr_quantum;
43 };
44 
45 #ifndef SCHED_TP
46 #define SCHED_TP 11
47 #define sched_tp_partition sched_u.tp.__sched_partition
48 #endif /* !SCHED_TP */
49 
50 struct __sched_tp_param {
51  int __sched_partition;
52 };
53 
54 struct sched_tp_window {
55  struct timespec offset;
56  struct timespec duration;
57  int ptid;
58 };
59 
60 enum {
61  sched_tp_install,
62  sched_tp_uninstall,
63  sched_tp_start,
64  sched_tp_stop,
65 };
66 
67 struct __sched_config_tp {
68  int op;
69  int nr_windows;
70  struct sched_tp_window windows[0];
71 };
72 
73 #define sched_tp_confsz(nr_win) \
74  (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))
75 
76 #ifndef SCHED_QUOTA
77 #define SCHED_QUOTA 12
78 #define sched_quota_group sched_u.quota.__sched_group
79 #endif /* !SCHED_QUOTA */
80 
81 struct __sched_quota_param {
82  int __sched_group;
83 };
84 
85 enum {
86  sched_quota_add,
87  sched_quota_remove,
88  sched_quota_force_remove,
89  sched_quota_set,
90  sched_quota_get,
91 };
92 
93 struct __sched_config_quota {
94  int op;
95  union {
96  struct {
97  int pshared;
98  } add;
99  struct {
100  int tgid;
101  } remove;
102  struct {
103  int tgid;
104  int quota;
105  int quota_peak;
106  } set;
107  struct {
108  int tgid;
109  } get;
110  };
111  struct __sched_quota_info {
112  int tgid;
113  int quota;
114  int quota_peak;
115  int quota_sum;
116  } info;
117 };
118 
119 #define sched_quota_confsz() sizeof(struct __sched_config_quota)
120 
121 struct sched_param_ex {
122  int sched_priority;
123  union {
124  struct __sched_ss_param ss;
125  struct __sched_rr_param rr;
126  struct __sched_tp_param tp;
127  struct __sched_quota_param quota;
128  } sched_u;
129 };
130 
131 union sched_config {
132  struct __sched_config_tp tp;
133  struct __sched_config_quota quota;
134 };
135 
136 #endif /* !_COBALT_UAPI_SCHED_H */