xref: /illumos-gate/usr/src/head/sched.h (revision ba3594ba)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24  *
25  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
28 
29 #ifndef	_SCHED_H
30 #define	_SCHED_H
31 
32 #include <sys/types.h>
33 #include <time.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 struct sched_param {
40 	int	sched_priority;	/* scheduling priority */
41 	int	sched_pad[8];
42 };
43 
44 /*
45  * POSIX scheduling policies
46  */
47 #define	SCHED_OTHER	0	/* traditional time-sharing scheduling class */
48 #define	SCHED_FIFO	1	/* real-time class: run to completion */
49 #define	SCHED_RR	2	/* real-time class: round-robin */
50 #define	SCHED_SYS	3	/* system scheduling class */
51 #define	SCHED_IA	4	/* interactive time-sharing class */
52 #define	SCHED_FSS	5	/* fair-share scheduling class */
53 #define	SCHED_FX	6	/* fixed-priority scheduling class */
54 #define	_SCHED_NEXT	7	/* first unassigned policy number */
55 
56 /*
57  * function prototypes
58  */
59 int	sched_getparam(pid_t, struct sched_param *);
60 int	sched_setparam(pid_t, const struct sched_param *);
61 int	sched_getscheduler(pid_t);
62 int	sched_setscheduler(pid_t, int, const struct sched_param *);
63 int	sched_yield(void);
64 int	sched_get_priority_max(int);
65 int	sched_get_priority_min(int);
66 int	sched_rr_get_interval(pid_t, struct timespec *);
67 
68 #ifdef	__cplusplus
69 }
70 #endif
71 
72 #endif	/* _SCHED_H */
73