test: fix tests including non-wrapper libgcc exception handling code
[uclibc-ng.git] / include / sched.h
blobf262a0be5a0adfcba0ca0fc84b0e43ed15ef7f0e
1 /* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
2 Copyright (C) 1996,1997,1999,2001-2004,2007 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _SCHED_H
20 #define _SCHED_H 1
22 #include <features.h>
24 /* Get type definitions. */
25 #include <bits/types.h>
27 #define __need_size_t
28 #include <stddef.h>
30 #define __need_timespec
31 #include <time.h>
33 /* Get system specific constant and data structure definitions. */
34 #include <bits/sched.h>
35 /* Define the real names for the elements of `struct sched_param'. */
36 #define sched_priority __sched_priority
39 __BEGIN_DECLS
41 /* Set scheduling parameters for a process. */
42 extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
43 __THROW;
45 /* Retrieve scheduling parameters for a particular process. */
46 extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW;
48 /* Set scheduling algorithm and/or parameters for a process. */
49 extern int sched_setscheduler (__pid_t __pid, int __policy,
50 const struct sched_param *__param) __THROW;
52 /* Retrieve scheduling algorithm for a particular purpose. */
53 extern int sched_getscheduler (__pid_t __pid) __THROW;
55 /* Yield the processor. */
56 extern int sched_yield (void) __THROW;
58 /* Get maximum priority value for a scheduler. */
59 extern int sched_get_priority_max (int __algorithm) __THROW;
61 /* Get minimum priority value for a scheduler. */
62 extern int sched_get_priority_min (int __algorithm) __THROW;
64 /* Get the SCHED_RR interval for the named process. */
65 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
68 #if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
69 /* Access macros for `cpu_set'. */
70 # define CPU_SETSIZE __CPU_SETSIZE
71 # define CPU_SET(cpu, cpusetp) __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
72 # define CPU_CLR(cpu, cpusetp) __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
73 # define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \
74 cpusetp)
75 # define CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
76 # define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
78 # define CPU_SET_S(cpu, setsize, cpusetp) __CPU_SET_S (cpu, setsize, cpusetp)
79 # define CPU_CLR_S(cpu, setsize, cpusetp) __CPU_CLR_S (cpu, setsize, cpusetp)
80 # define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \
81 cpusetp)
82 # define CPU_ZERO_S(setsize, cpusetp) __CPU_ZERO_S (setsize, cpusetp)
83 # define CPU_COUNT_S(setsize, cpusetp) __CPU_COUNT_S (setsize, cpusetp)
85 # define CPU_EQUAL(cpusetp1, cpusetp2) \
86 __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2)
87 # define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
88 __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2)
90 # define CPU_AND(destset, srcset1, srcset2) \
91 __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
92 # define CPU_OR(destset, srcset1, srcset2) \
93 __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
94 # define CPU_XOR(destset, srcset1, srcset2) \
95 __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
96 # define CPU_AND_S(setsize, destset, srcset1, srcset2) \
97 __CPU_OP_S (setsize, destset, srcset1, srcset2, &)
98 # define CPU_OR_S(setsize, destset, srcset1, srcset2) \
99 __CPU_OP_S (setsize, destset, srcset1, srcset2, |)
100 # define CPU_XOR_S(setsize, destset, srcset1, srcset2) \
101 __CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
103 # define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count)
104 # define CPU_ALLOC(count) __CPU_ALLOC (count)
105 # define CPU_FREE(cpuset) __CPU_FREE (cpuset)
108 /* Set the CPU affinity for a task */
109 extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
110 const cpu_set_t *__cpuset) __THROW;
112 /* Get the CPU affinity for a task */
113 extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
114 cpu_set_t *__cpuset) __THROW;
116 # ifdef _LIBC
117 extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
118 int __flags, void *__arg, ...);
119 extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
120 size_t __child_stack_size, int __flags, void *__arg, ...);
121 # endif
123 #endif
125 __END_DECLS
127 #endif /* sched.h */