1 /*
2  *  Written by Joel Sherrill <joel@OARcorp.com>.
3  *
4  *  COPYRIGHT (c) 1989-2010.
5  *  On-Line Applications Research Corporation (OAR).
6  *
7  *  Permission to use, copy, modify, and distribute this software for any
8  *  purpose without fee is hereby granted, provided that this entire notice
9  *  is included in all copies of any software which is or includes a copy
10  *  or modification of this software.
11  *
12  *  THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
13  *  WARRANTY.  IN PARTICULAR,  THE AUTHOR MAKES NO REPRESENTATION
14  *  OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
15  *  SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
16  *
17  *  $Id$
18  */
19 
20 #ifndef _SCHED_H_
21 #define _SCHED_H_
22 
23 #include <sys/cdefs.h>
24 #include <sys/types.h>
25 #include <sys/sched.h>
26 
27 _BEGIN_STD_C
28 
29 #if defined(_POSIX_PRIORITY_SCHEDULING)
30 /*
31  *  XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803
32  */
33 int sched_setparam(
34   pid_t                     __pid,
35   const struct sched_param *__param
36 );
37 
38 /*
39  *  XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800
40  */
41 int sched_getparam(
42   pid_t                     __pid,
43   struct sched_param       *__param
44 );
45 
46 /*
47  *  XBD 13 - Set Scheduling Policy and Scheduling Parameters,
48  *         P1003.1b-2008, p. 1805
49  */
50 int sched_setscheduler(
51   pid_t                     __pid,
52   int                       __policy,
53   const struct sched_param *__param
54 );
55 
56 /*
57  *  XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801
58  */
59 int sched_getscheduler(
60   pid_t                     __pid
61 );
62 
63 /*
64  *  XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799
65  */
66 int sched_get_priority_max(
67   int __policy
68 );
69 
70 int sched_get_priority_min(
71   int  __policy
72 );
73 
74 /*
75  *  XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802
76  */
77 int sched_rr_get_interval(
78   pid_t             __pid,
79   struct timespec  *__interval
80 );
81 #endif /* _POSIX_PRIORITY_SCHEDULING */
82 
83 #if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
84 
85 /*
86  *  XBD 13 - Yield Processor, P1003.1b-2008, p. 1807
87  */
88 int sched_yield( void );
89 
90 #endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
91 
92 #if __GNU_VISIBLE
93 int sched_getcpu(void);
94 
95 /* The following functions should only be declared if the type
96    cpu_set_t is defined through indirect inclusion of sys/cpuset.h,
97    only available on some targets. */
98 #ifdef _SYS_CPUSET_H_
99 int sched_getaffinity (pid_t, size_t, cpu_set_t *);
100 int sched_get_thread_affinity (void *, size_t, cpu_set_t *);
101 int sched_setaffinity (pid_t, size_t, const cpu_set_t *);
102 int sched_set_thread_affinity (void *, size_t, const cpu_set_t *);
103 #endif /* _SYS_CPUSET_H_ */
104 
105 #endif
106 
107 _END_STD_C
108 
109 #endif /* _SCHED_H_ */
110