]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/kernel-features.h
Remove __ASSUME_SWAPCONTEXT_SYSCALL.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / kernel-features.h
CommitLineData
958f238f
UD
1/* Set flags signalling availability of kernel features based on given
2 kernel version number.
b13b9885 3 Copyright (C) 1999-2009, 2010, 2011, 2012 Free Software Foundation, Inc.
958f238f
UD
4 This file is part of the GNU C Library.
5
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.
958f238f
UD
10
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.
958f238f 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
958f238f
UD
19
20/* This file must not contain any C code. At least it must be protected
21 to allow using the file also in assembler files. */
22
958f238f
UD
23#ifndef __LINUX_KERNEL_VERSION
24/* We assume the worst; all kernels should be supported. */
25# define __LINUX_KERNEL_VERSION 0
26#endif
27
28/* We assume for __LINUX_KERNEL_VERSION the same encoding used in
29 linux/version.h. I.e., the major, minor, and subminor all get a
30 byte with the major number being in the highest byte. This means
31 we can do numeric comparisons.
32
33 In the following we will define certain symbols depending on
34 whether the describes kernel feature is available in the kernel
35 version given by __LINUX_KERNEL_VERSION. We are not always exactly
36 recording the correct versions in which the features were
37 introduced. If somebody cares these values can afterwards be
ffb7875d 38 corrected. */
958f238f 39
eac10791 40/* The sendfile syscall was introduced in 2.2.0. */
ffb7875d 41#define __ASSUME_SENDFILE 1
f9d07577 42
63a34b0f 43/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */
21708942 44#ifdef __i386__
63a34b0f
UD
45# define __ASSUME_STAT64_SYSCALL 1
46#endif
29332175 47
348363b2
JM
48/* On sparc the stat64/lstat64/fstat64 syscalls were introduced in
49 2.3.35. */
21708942 50#if defined __sparc__ && !defined __arch64__
29332175
UD
51# define __ASSUME_STAT64_SYSCALL 1
52#endif
313fed01 53
330fad29 54/* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not
463ed2f0 55 support separate 64-bit syscalls, already 64-bit. */
21708942 56#if defined __powerpc__ && !defined __powerpc64__
053cc7bb 57# define __ASSUME_STAT64_SYSCALL 1
053cc7bb
GK
58#endif
59
21708942
JM
60/* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on
61 PPC introduced a correct IPC64. But PowerPC64 does not support a
62 separate 64-bit syscall, already 64-bit. */
63#ifndef __powerpc64__
51a8c49d
RM
64# define __ASSUME_IPC64 1
65#endif
66
348363b2 67/* SH kernels got stat64 during 2.4.0-test. */
21708942 68#ifdef __sh__
1e2e27fd 69# define __ASSUME_STAT64_SYSCALL 1
a074fa3c 70#endif
56ddf355 71
ec332e94 72/* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
1e2e27fd 73 and still does not have a 64-bit inode field. */
ec332e94 74#ifndef __sh__
56ddf355
UD
75# define __ASSUME_ST_INO_64_BIT 1
76#endif
21f6a100 77
ec332e94
JM
78/* The getdents64 syscall was introduced in 2.4.0-test7 (but later for
79 MIPS n32). */
80#define __ASSUME_GETDENTS64_SYSCALL 1
846c6907 81
f3423d5a 82/* Beginning with 2.6.12 the clock and timer supports CPU clocks. */
6dad2c06 83#define __ASSUME_POSIX_CPU_TIMERS 1
f3423d5a 84
7aab07e4
JM
85/* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
86#define __ASSUME_STATFS64 1
c801e765 87
f4e0175f 88/* The utimes syscall has been available for some architectures
5085cd1f 89 forever. For x86 it was introduced after 2.5.75, for x86-64,
445f7ecd
JM
90 ppc, and ppc64 it was introduced in 2.6.0-test3, for s390 it was
91 introduced in 2.6.21-rc5. */
b13b9885 92#if defined __sparc__ \
7aab07e4 93 || defined __i386__ \
6dad2c06
JM
94 || defined __x86_64__ \
95 || defined __powerpc__ \
445f7ecd
JM
96 || defined __sh__ \
97 || (defined __s390__ && __LINUX_KERNEL_VERSION >= 0x020616)
82bae9f9
UD
98# define __ASSUME_UTIMES 1
99#endif
0cbc6c4e 100
bfef9264 101/* The fixed version of the posix_fadvise64 syscall appeared in
b4b2eb5e
DM
102 2.6.0-test3. At least for x86 and sparc. Powerpc support appeared
103 in 2.6.2, but for 32-bit userspace only. */
6dad2c06
JM
104#if (defined __i386__ || defined __sparc__ \
105 || (defined __powerpc__ && !defined __powerpc64__))
bfef9264
UD
106# define __ASSUME_FADVISE64_64_SYSCALL 1
107#endif
5cb48b84 108
49783c67 109/* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12. */
6dad2c06 110#if defined __sparc__ && defined __arch64__
49783c67
UD
111# define __ASSUME_STAT64_SYSCALL 1
112#endif
2d79a585 113
22502ea2
UD
114/* pselect/ppoll were introduced just after 2.6.16-rc1. Due to the way
115 the kernel versions are advertised we can only rely on 2.6.17 to have
116 the code. On x86_64 and SH this appeared first in 2.6.19-rc1,
3155f066 117 on ia64 in 2.6.22-rc1. */
22502ea2 118#if __LINUX_KERNEL_VERSION >= 0x020611 \
b13b9885 119 && ((!defined __x86_64__ && !defined __sh__) \
22502ea2 120 || (__LINUX_KERNEL_VERSION >= 0x020613 \
b13b9885 121 && (defined __x86_64__ || defined __sh__)))
7c65e900 122# define __ASSUME_PSELECT 1
22502ea2 123# define __ASSUME_PPOLL 1
7c65e900
UD
124#endif
125
126/* The *at syscalls were introduced just after 2.6.16-rc1. Due to the way the
127 kernel versions are advertised we can only rely on 2.6.17 to have
3155f066
UD
128 the code. On PPC they were introduced in 2.6.17-rc1,
129 on SH in 2.6.19-rc1. */
22502ea2 130#if __LINUX_KERNEL_VERSION >= 0x020611 \
3155f066 131 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
7c65e900
UD
132# define __ASSUME_ATFCTS 1
133#endif
0f6699ea
UD
134
135/* Support for inter-process robust mutexes was added in 2.6.17. */
22502ea2 136#if __LINUX_KERNEL_VERSION >= 0x020611 \
3155f066 137 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
0f6699ea
UD
138# define __ASSUME_SET_ROBUST_LIST 1
139#endif
d5ba53f9 140
2dbe6afe
UD
141/* Pessimistically assume that 2.6.18 introduced real handling of
142 large numbers of requests to readv and writev and that we don't
143 need a fallback. It likely worked for much longer. */
144#if __LINUX_KERNEL_VERSION >= 0x020612
145# define __ASSUME_COMPLETE_READV_WRITEV 1
146#endif
147
d5ba53f9
UD
148/* Support for PI futexes was added in 2.6.18. */
149#if __LINUX_KERNEL_VERSION >= 0x020612
150# define __ASSUME_FUTEX_LOCK_PI 1
151#endif
c27d2078 152
3155f066 153/* Support for utimensat syscall was added in 2.6.22, on SH
22502ea2
UD
154 only after 2.6.22-rc1. */
155#if __LINUX_KERNEL_VERSION >= 0x020616 \
3155f066 156 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020617)
c27d2078
UD
157# define __ASSUME_UTIMENSAT 1
158#endif
4f099bb5
UD
159
160/* Support for private futexes was added in 2.6.22. */
161#if __LINUX_KERNEL_VERSION >= 0x020616
162# define __ASSUME_PRIVATE_FUTEX 1
163#endif
c1bf9f14 164
22502ea2
UD
165/* Support for fallocate was added in 2.6.23, on s390
166 only after 2.6.23-rc1. */
167#if __LINUX_KERNEL_VERSION >= 0x020617 \
3155f066 168 && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618)
c1bf9f14
UD
169# define __ASSUME_FALLOCATE 1
170#endif
ae18718f 171
46bc5d43
UD
172/* Support for various CLOEXEC and NONBLOCK flags was added for x86,
173 x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */
174#if __LINUX_KERNEL_VERSION >= 0x020617 \
175 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
b13b9885 176 || defined __sparc__ || defined __s390__)
46bc5d43
UD
177# define __ASSUME_O_CLOEXEC 1
178#endif
179
121dce05
JM
180/* From 2.6.23 onwards the value of ARG_MAX depends on the stack
181 size. */
182#define __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL 0x020617
183#if __LINUX_KERNEL_VERSION >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL
184# define __ASSUME_ARG_MAX_STACK_BASED 1
185#endif
186
ae18718f
UD
187/* Support for ADJ_OFFSET_SS_READ was added in 2.6.24. */
188#if __LINUX_KERNEL_VERSION >= 0x020618
189# define __ASSUME_ADJ_OFFSET_SS_READ 1
190#endif
0e077a7e 191
b5c0b5e4 192/* Support for various CLOEXEC and NONBLOCK flags was added for x86,
bdd24a30 193 x86-64, PPC, IA-64, and SPARC in 2.6.27. */
3ff2c948 194#if __LINUX_KERNEL_VERSION >= 0x02061b \
b5c0b5e4 195 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
b13b9885 196 || defined __sparc__ || defined __s390__)
3ff2c948
UD
197# define __ASSUME_SOCK_CLOEXEC 1
198# define __ASSUME_IN_NONBLOCK 1
d6e0c2a6 199# define __ASSUME_PIPE2 1
aa7492d2
UD
200# define __ASSUME_EVENTFD2 1
201# define __ASSUME_SIGNALFD4 1
94b7cc37 202# define __ASSUME_DUP3 1
f93fc0b7
UD
203#endif
204
205/* Support for the accept4 syscall was added in 2.6.28. */
200da00a 206#if __LINUX_KERNEL_VERSION >= 0x02061c \
f93fc0b7 207 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
3533b1a6 208 || defined __sparc__ || defined __s390__)
f93fc0b7 209# define __ASSUME_ACCEPT4 1
3ff2c948 210#endif
ebb2788e
UD
211
212/* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
7dd650d7 213#if __LINUX_KERNEL_VERSION >= 0x02061d
ebb2788e
UD
214# define __ASSUME_FUTEX_CLOCK_REALTIME 1
215#endif
e109c612 216
4300afc1
UD
217/* Support for the AT_RANDOM auxiliary vector entry was added in 2.6.29. */
218#if __LINUX_KERNEL_VERSION >= 0x02061d
219# define __ASSUME_AT_RANDOM 1
220#endif
221
e109c612 222/* Support for preadv and pwritev was added in 2.6.30. */
11cad88c 223#if __LINUX_KERNEL_VERSION >= 0x02061e
e109c612
UD
224# define __ASSUME_PREADV 1
225# define __ASSUME_PWRITEV 1
226#endif
81c84bd9
UD
227
228/* Support for F_GETOWN_EX was introduced in 2.6.32. */
229#if __LINUX_KERNEL_VERSION >= 0x020620
230# define __ASSUME_F_GETOWN_EX 1
231#endif
3d04ff3a
AS
232
233/* Support for the recvmmsg syscall was added in 2.6.33. */
234#if __LINUX_KERNEL_VERSION >= 0x020621
235# define __ASSUME_RECVMMSG 1
236#endif
3cdaa6ad
UD
237
238/* statfs fills in f_flags since 2.6.36. */
239#if __LINUX_KERNEL_VERSION >= 0x020624
240# define __ASSUME_STATFS_F_FLAGS 1
241#endif
5bd6dc5c
UD
242
243/* prlimit64 is available in 2.6.36. */
244#if __LINUX_KERNEL_VERSION >= 0x020624
245# define __ASSUME_PRLIMIT64 1
246#endif
f1f929d7
UD
247
248/* sendmmsg is available in 2.6.39. */
249#if __LINUX_KERNEL_VERSION >= 0x020627
250# define __ASSUME_SENDMMSG 1
251#endif
ef606249
UD
252
253/* getcpu is a syscall for x86-64 since 3.1. */
254#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
255# define __ASSUME_GETCPU_SYSCALL 1
256#endif