xref: /illumos-gate/usr/src/head/sched.h (revision c8e880c1386b032ac975c61826ba3bc0d8dce5ac)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1993-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SCHED_H
28 #define	_SCHED_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
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;	/* process execution scheduling priority */
41 	int	sched_nicelim;	/* nice value limit for SCHED_OTHER policy */
42 	int	sched_nice;	/* nice value for SCHED_OTHER policy */
43 	int	sched_pad[6];	/* pad to the same size as pcparms_t of */
44 				/* sys/priocntl.h */
45 				/*	sizeof(sched_priority) +	*/
46 				/*	sizeof(pcparms_t.pc_clparms)	*/
47 };
48 
49 /*
50  *	POSIX scheduling policies
51  */
52 #define	SCHED_OTHER	0
53 #define	SCHED_FIFO	1	/* run to completion */
54 #define	SCHED_RR	2	/* round-robin */
55 #define	SCHED_SYS	3	/* sys scheduling class */
56 #define	SCHED_IA	4	/* interactive class */
57 #define	_SCHED_NEXT	5	/* first unassigned policy number */
58 
59 /*
60  * function prototypes
61  */
62 #if	defined(__STDC__)
63 int	sched_getparam(pid_t, struct sched_param *);
64 int	sched_setparam(pid_t, const struct sched_param *);
65 int	sched_getscheduler(pid_t);
66 int	sched_setscheduler(pid_t, int, const struct sched_param *);
67 int	sched_yield(void);
68 int	sched_get_priority_max(int);
69 int	sched_get_priority_min(int);
70 int	sched_rr_get_interval(pid_t, struct timespec *);
71 #else
72 int	sched_getparam();
73 int	sched_setparam();
74 int	sched_getscheduler();
75 int	sched_setscheduler();
76 int	sched_yield();
77 int	sched_get_priority_max();
78 int	sched_get_priority_min();
79 int	sched_rr_get_interval();
80 #endif	/* __STDC__ */
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _SCHED_H */
87