sched.h 2.82 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
/*
 * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#ifndef _COBALT_UAPI_SCHED_H
#define _COBALT_UAPI_SCHED_H

#define SCHED_COBALT		42
#define SCHED_WEAK		43

#ifndef SCHED_SPORADIC
#define SCHED_SPORADIC		10
#define sched_ss_low_priority	sched_u.ss.__sched_low_priority
#define sched_ss_repl_period	sched_u.ss.__sched_repl_period
#define sched_ss_init_budget	sched_u.ss.__sched_init_budget
#define sched_ss_max_repl	sched_u.ss.__sched_max_repl
#endif	/* !SCHED_SPORADIC */

#define sched_rr_quantum	sched_u.rr.__sched_rr_quantum

struct __sched_ss_param {
	int __sched_low_priority;
	struct timespec __sched_repl_period;
	struct timespec __sched_init_budget;
	int __sched_max_repl;
};

struct __sched_rr_param {
	struct timespec __sched_rr_quantum;
};

#ifndef SCHED_TP
#define SCHED_TP		11
#define sched_tp_partition	sched_u.tp.__sched_partition
#endif	/* !SCHED_TP */

struct __sched_tp_param {
	int __sched_partition;
};

struct sched_tp_window {
	struct timespec offset;
	struct timespec duration;
	int ptid;
};

struct __sched_config_tp {
	int nr_windows;
	struct sched_tp_window windows[0];
};

65 66 67
#define sched_tp_confsz(nr_win) \
  (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))

68 69 70 71 72 73 74 75 76 77 78 79
#ifndef SCHED_QUOTA
#define SCHED_QUOTA		12
#define sched_quota_group	sched_u.quota.__sched_group
#endif	/* !SCHED_QUOTA */

struct __sched_quota_param {
	int __sched_group;
};

enum {
	sched_quota_add,
	sched_quota_remove,
80 81
	sched_quota_set,
	sched_quota_get,
82 83 84 85
};

struct __sched_config_quota {
	int op;
86
	int *sum_r;
87
	struct {
88
		int pshared;
89 90 91 92 93 94 95 96 97 98
		int *tgid_r;
	} add;
	struct {
		int tgid;
	} remove;
	struct {
		int tgid;
		int quota;
		int quota_peak;
	} set;
99 100 101 102 103
	struct {
		int tgid;
		int *quota_r;
		int *quota_peak_r;
	} get;
104 105
};

106 107
#define sched_quota_confsz()  sizeof(struct __sched_config_quota)

108 109 110 111 112 113 114 115 116 117
struct sched_param_ex {
	int sched_priority;
	union {
		struct __sched_ss_param ss;
		struct __sched_rr_param rr;
		struct __sched_tp_param tp;
		struct __sched_quota_param quota;
	} sched_u;
};

118 119
union sched_config {
	struct __sched_config_tp tp;
120
	struct __sched_config_quota quota;
121 122 123
};

#endif /* !_COBALT_UAPI_SCHED_H */