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/types.h> 24 #include <sys/sched.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 #if defined(_POSIX_PRIORITY_SCHEDULING) 31 /* 32 * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803 33 */ 34 int sched_setparam( 35 pid_t __pid, 36 const struct sched_param *__param 37 ); 38 39 /* 40 * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800 41 */ 42 int sched_getparam( 43 pid_t __pid, 44 struct sched_param *__param 45 ); 46 47 /* 48 * XBD 13 - Set Scheduling Policy and Scheduling Parameters, 49 * P1003.1b-2008, p. 1805 50 */ 51 int sched_setscheduler( 52 pid_t __pid, 53 int __policy, 54 const struct sched_param *__param 55 ); 56 57 /* 58 * XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801 59 */ 60 int sched_getscheduler( 61 pid_t __pid 62 ); 63 64 /* 65 * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799 66 */ 67 int sched_get_priority_max( 68 int __policy 69 ); 70 71 int sched_get_priority_min( 72 int __policy 73 ); 74 75 /* 76 * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802 77 */ 78 int sched_rr_get_interval( 79 pid_t __pid, 80 struct timespec *__interval 81 ); 82 #endif /* _POSIX_PRIORITY_SCHEDULING */ 83 84 #if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING) 85 86 /* 87 * XBD 13 - Yield Processor, P1003.1b-2008, p. 1807 88 */ 89 int sched_yield( void ); 90 91 #endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */ 92 93 #if __GNU_VISIBLE 94 int sched_getcpu(void); 95 96 /* The following functions should only be declared if the type 97 cpu_set_t is defined through indirect inclusion of sys/cpuset.h, 98 only available on some targets. */ 99 #ifdef _SYS_CPUSET_H_ 100 int sched_getaffinity (pid_t, size_t, cpu_set_t *); 101 int sched_get_thread_affinity (void *, size_t, cpu_set_t *); 102 int sched_setaffinity (pid_t, size_t, const cpu_set_t *); 103 int sched_set_thread_affinity (void *, size_t, const cpu_set_t *); 104 #endif /* _SYS_CPUSET_H_ */ 105 106 #endif 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 #endif /* _SCHED_H_ */ 113