Xenomai  3.0-rc3
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 struct __sched_config_tp {
61  int nr_windows;
62  struct sched_tp_window windows[0];
63 };
64 
65 #define sched_tp_confsz(nr_win) \
66  (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))
67 
68 #ifndef SCHED_QUOTA
69 #define SCHED_QUOTA 12
70 #define sched_quota_group sched_u.quota.__sched_group
71 #endif /* !SCHED_QUOTA */
72 
73 struct __sched_quota_param {
74  int __sched_group;
75 };
76 
77 enum {
78  sched_quota_add,
79  sched_quota_remove,
80  sched_quota_force_remove,
81  sched_quota_set,
82  sched_quota_get,
83 };
84 
85 struct __sched_config_quota {
86  int op;
87  union {
88  struct {
89  int pshared;
90  } add;
91  struct {
92  int tgid;
93  } remove;
94  struct {
95  int tgid;
96  int quota;
97  int quota_peak;
98  } set;
99  struct {
100  int tgid;
101  } get;
102  };
103  struct __sched_quota_info {
104  int tgid;
105  int quota;
106  int quota_peak;
107  int quota_sum;
108  } info;
109 };
110 
111 #define sched_quota_confsz() sizeof(struct __sched_config_quota)
112 
113 struct sched_param_ex {
114  int sched_priority;
115  union {
116  struct __sched_ss_param ss;
117  struct __sched_rr_param rr;
118  struct __sched_tp_param tp;
119  struct __sched_quota_param quota;
120  } sched_u;
121 };
122 
123 union sched_config {
124  struct __sched_config_tp tp;
125  struct __sched_config_quota quota;
126 };
127 
128 #endif /* !_COBALT_UAPI_SCHED_H */