xref: /openbsd/include/sched.h (revision 249f38f2)
1*249f38f2Sguenther /*	$OpenBSD: sched.h,v 1.1 2017/10/15 23:40:33 guenther Exp $	*/
2*249f38f2Sguenther 
3*249f38f2Sguenther /* sched.h: POSIX 1003.1b Process Scheduling header */
4*249f38f2Sguenther 
5*249f38f2Sguenther /*-
6*249f38f2Sguenther  * Copyright (c) 1996, 1997
7*249f38f2Sguenther  *	HD Associates, Inc.  All rights reserved.
8*249f38f2Sguenther  *
9*249f38f2Sguenther  * Redistribution and use in source and binary forms, with or without
10*249f38f2Sguenther  * modification, are permitted provided that the following conditions
11*249f38f2Sguenther  * are met:
12*249f38f2Sguenther  * 1. Redistributions of source code must retain the above copyright
13*249f38f2Sguenther  *    notice, this list of conditions and the following disclaimer.
14*249f38f2Sguenther  * 2. Redistributions in binary form must reproduce the above copyright
15*249f38f2Sguenther  *    notice, this list of conditions and the following disclaimer in the
16*249f38f2Sguenther  *    documentation and/or other materials provided with the distribution.
17*249f38f2Sguenther  * 3. All advertising materials mentioning features or use of this software
18*249f38f2Sguenther  *    must display the following acknowledgement:
19*249f38f2Sguenther  *	This product includes software developed by HD Associates, Inc
20*249f38f2Sguenther  *	and Jukka Antero Ukkonen.
21*249f38f2Sguenther  * 4. Neither the name of the author nor the names of any co-contributors
22*249f38f2Sguenther  *    may be used to endorse or promote products derived from this software
23*249f38f2Sguenther  *    without specific prior written permission.
24*249f38f2Sguenther  *
25*249f38f2Sguenther  * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
26*249f38f2Sguenther  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27*249f38f2Sguenther  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28*249f38f2Sguenther  * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
29*249f38f2Sguenther  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30*249f38f2Sguenther  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31*249f38f2Sguenther  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32*249f38f2Sguenther  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33*249f38f2Sguenther  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34*249f38f2Sguenther  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35*249f38f2Sguenther  * SUCH DAMAGE.
36*249f38f2Sguenther  *
37*249f38f2Sguenther  */
38*249f38f2Sguenther 
39*249f38f2Sguenther #ifndef _SCHED_H_
40*249f38f2Sguenther #define _SCHED_H_
41*249f38f2Sguenther 
42*249f38f2Sguenther #include <sys/types.h>	/* For pid_t */
43*249f38f2Sguenther #include <time.h>	/* Per P1003.4 */
44*249f38f2Sguenther 
45*249f38f2Sguenther /* Scheduling policies
46*249f38f2Sguenther  */
47*249f38f2Sguenther #define SCHED_FIFO  1
48*249f38f2Sguenther #define SCHED_OTHER 2
49*249f38f2Sguenther #define SCHED_RR    3
50*249f38f2Sguenther 
51*249f38f2Sguenther struct sched_param
52*249f38f2Sguenther {
53*249f38f2Sguenther 	int sched_priority;
54*249f38f2Sguenther };
55*249f38f2Sguenther 
56*249f38f2Sguenther __BEGIN_DECLS
57*249f38f2Sguenther #if 0	/* not yet */
58*249f38f2Sguenther int sched_setparam(pid_t, const struct sched_param *);
59*249f38f2Sguenther int sched_getparam(pid_t, struct sched_param *);
60*249f38f2Sguenther 
61*249f38f2Sguenther int sched_setscheduler(pid_t, int, const struct sched_param *);
62*249f38f2Sguenther int sched_getscheduler(pid_t);
63*249f38f2Sguenther #endif
64*249f38f2Sguenther 
65*249f38f2Sguenther int sched_yield(void);
66*249f38f2Sguenther int sched_get_priority_max(int);
67*249f38f2Sguenther int sched_get_priority_min(int);
68*249f38f2Sguenther 
69*249f38f2Sguenther #if 0	/* not yet */
70*249f38f2Sguenther struct timespec;
71*249f38f2Sguenther int sched_rr_get_interval(pid_t, struct timespec *);
72*249f38f2Sguenther #endif
73*249f38f2Sguenther __END_DECLS
74*249f38f2Sguenther 
75*249f38f2Sguenther #endif /* _SCHED_H_ */
76