]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/bits/sched.h
Fix typo.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / bits / sched.h
CommitLineData
edf5b2d7
UD
1/* Definitions of constants and data structure for POSIX 1003.1b-1993
2 scheduling interface.
949ec764 3 Copyright (C) 1996-1999,2001,2002,2003 Free Software Foundation, Inc.
10dc2a90 4 This file is part of the GNU C Library.
edf5b2d7 5
10dc2a90 6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
edf5b2d7 10
10dc2a90
UD
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 14 Lesser General Public License for more details.
edf5b2d7 15
41bdb6e2
AJ
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
edf5b2d7 20
4959e310
UD
21#ifndef __need_schedparam
22
5107cf1d 23#ifndef _SCHED_H
f4017d20 24# error "Never include <bits/sched.h> directly; use <sched.h> instead."
5107cf1d
UD
25#endif
26
0c5ecdc4 27
edf5b2d7
UD
28/* Scheduling algorithms. */
29#define SCHED_OTHER 0
30#define SCHED_FIFO 1
31#define SCHED_RR 2
32
f4017d20 33#ifdef __USE_MISC
edf5b2d7 34/* Cloning flags. */
f4017d20
UD
35# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */
36# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */
3387a425
UD
37# define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */
38# define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */
f4017d20
UD
39# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */
40# define CLONE_PID 0x00001000 /* Set if pid shared. */
3387a425 41# define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */
d53afacb
UD
42# define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to
43 wake it up on mm_release. */
755e51be
UD
44# define CLONE_PARENT 0x00008000 /* Set if we want to have the same
45 parent as the cloner. */
46# define CLONE_THREAD 0x00010000 /* Set to add to same thread group. */
47# define CLONE_NEWNS 0x00020000 /* Set to create new namespace. */
48# define CLONE_SYSVSEM 0x00040000 /* Set to shared SVID SEM_UNDO semantics. */
49# define CLONE_SETTLS 0x00080000 /* Set TLS info. */
50# define CLONE_PARENT_SETTID 0x00100000 /* Store TID in userlevel buffer
51 before MM copy. */
52# define CLONE_CHILD_CLEARTID 0x00200000 /* Register exit futex and memory
53 location to clear. */
54# define CLONE_DETACHED 0x00400000 /* Create clone detached. */
55# define CLONE_UNTRACED 0x00800000 /* Set if the tracing process can't
56 force CLONE_PTRACE on this clone. */
57# define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in
58 the child. */
f4017d20 59#endif
edf5b2d7 60
4959e310
UD
61/* The official definition. */
62struct sched_param
63 {
4a2c9975 64 int __sched_priority;
4959e310 65 };
edf5b2d7 66
f4017d20
UD
67__BEGIN_DECLS
68
0c5ecdc4 69/* Clone current process. */
0c5ecdc4 70#ifdef __USE_MISC
4d3a563f
UD
71extern int clone (int (*__fn) (void *__arg), void *__child_stack,
72 int __flags, void *__arg) __THROW;
0c5ecdc4 73#endif
f4017d20 74
ba9234d9
UD
75__END_DECLS
76
4959e310
UD
77#endif /* need schedparam */
78
79#if !defined __defined_schedparam \
80 && (defined __need_schedparam || defined _SCHED_H)
81# define __defined_schedparam 1
82/* Data structure to describe a process' schedulability. */
83struct __sched_param
84 {
4a2c9975 85 int __sched_priority;
4959e310
UD
86 };
87# undef __need_schedparam
88#endif
949ec764
UD
89
90
91/* Size definition for CPU sets. */
92#define __CPU_SETSIZE 1024
93#define __NCPUBITS (8 * sizeof (__cpu_mask))
94
95/* Type for array elements in 'cpu_set'. */
96typedef unsigned long int __cpu_mask;
97
98/* Basic access functions. */
99#define __CPUELT(cpu) ((cpu) / __NCPUBITS)
100#define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
101
102/* Data structure to describe CPU mask. */
103typedef struct
104{
105 __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
106} cpu_set_t;
107
108/* Access functions for CPU masks. */
109#define __CPU_ZERO(cpusetp) \
110 do { \
111 unsigned int __i; \
112 cpu_set *__arr = (cpusetp); \
113 for (__i = 0; __i < sizeof (cpu_set) / sizeof (__cpu_mask); ++__i) \
114 __arr->__bits[__i] = 0; \
115 } while (0)
116#define __CPU_SET(cpu, cpusetp) \
117 ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu))
118#define __CPU_CLR(cpu, cpusetp) \
119 ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu))
120#define __CPU_ISSET(cpu, cpusetp) \
121 (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0)