sched.h 3.04 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
/*
 * 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

24 25 26
/* for internal use */
#define __SCHED_CURRENT		44

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#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 */

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

42 43
#define sched_rr_quantum	sched_u.rr.__sched_rr_quantum

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
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;
};

63 64 65 66 67 68 69
enum {
	sched_tp_install,
	sched_tp_uninstall,
	sched_tp_start,
	sched_tp_stop,
};
	
70
struct __sched_config_tp {
71
	int op;
72 73 74 75
	int nr_windows;
	struct sched_tp_window windows[0];
};

76 77 78
#define sched_tp_confsz(nr_win) \
  (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))

79 80 81 82 83 84 85 86 87 88 89 90
#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,
91
	sched_quota_force_remove,
92 93
	sched_quota_set,
	sched_quota_get,
94 95 96 97
};

struct __sched_config_quota {
	int op;
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
	union {
		struct {
			int pshared;
		} add;
		struct {
			int tgid;
		} remove;
		struct {
			int tgid;
			int quota;
			int quota_peak;
		} set;
		struct {
			int tgid;
		} get;
	};
	struct __sched_quota_info {
115 116 117
		int tgid;
		int quota;
		int quota_peak;
118 119
		int quota_sum;
	} info;
120 121
};

122 123
#define sched_quota_confsz()  sizeof(struct __sched_config_quota)

124 125 126 127 128 129 130 131 132 133
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;
};

134 135
union sched_config {
	struct __sched_config_tp tp;
136
	struct __sched_config_quota quota;
137 138 139
};

#endif /* !_COBALT_UAPI_SCHED_H */