]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/kernel-features.h
Remove some pre-2.6.16 Linux kernel conditionals.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / kernel-features.h
1 /* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 1999-2009, 2010, 2011, 2012 Free Software Foundation, Inc.
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
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.
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
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
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
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
38 corrected. */
39
40 /* The sendfile syscall was introduced in 2.2.0. */
41 #define __ASSUME_SENDFILE 1
42
43 /* On x86 the mmap2 syscall was introduced in 2.3.31. */
44 #ifdef __i386__
45 # define __ASSUME_MMAP2_SYSCALL 1
46 #endif
47
48 /* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */
49 #ifdef __i386__
50 # define __ASSUME_STAT64_SYSCALL 1
51 #endif
52
53 /* On sparc the mmap2/stat64/lstat64/fstat64 syscalls were introduced
54 in 2.3.35. */
55 #if defined __sparc__ && !defined __arch64__
56 # define __ASSUME_MMAP2_SYSCALL 1
57 # define __ASSUME_STAT64_SYSCALL 1
58 #endif
59
60 /* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not
61 support separate 64-bit syscalls, already 64-bit. */
62 #if defined __powerpc__ && !defined __powerpc64__
63 # define __ASSUME_STAT64_SYSCALL 1
64 #endif
65
66 /* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on
67 PPC introduced a correct IPC64. But PowerPC64 does not support a
68 separate 64-bit syscall, already 64-bit. */
69 #ifndef __powerpc64__
70 # define __ASSUME_IPC64 1
71 #endif
72
73 /* SH kernels got stat64 and mmap2 during 2.4.0-test. */
74 #ifdef __sh__
75 # define __ASSUME_MMAP2_SYSCALL 1
76 # define __ASSUME_STAT64_SYSCALL 1
77 #endif
78
79 /* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
80 and still does not have a 64-bit inode field. */
81 #ifndef __sh__
82 # define __ASSUME_ST_INO_64_BIT 1
83 #endif
84
85 /* The getdents64 syscall was introduced in 2.4.0-test7 (but later for
86 MIPS n32). */
87 #define __ASSUME_GETDENTS64_SYSCALL 1
88
89 /* Starting with 2.4.5 kernels the mmap2 syscall made it into the official
90 kernel. But PowerPC64 does not support a separate MMAP2 call. */
91 #if defined __powerpc__ && !defined __powerpc64__
92 # define __ASSUME_MMAP2_SYSCALL 1
93 #endif
94
95 /* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize
96 their availability with one define. The changes were made first
97 for i386 and the have to be done separately for the other archs.
98 For i386 we pick 2.5.50 as the first version with support.
99 For s390*, SPARC, PPC, x86-64, and SH we pick 2.5.64 as the first
100 version with support. */
101 #if (defined __i386__ || defined __s390__ || defined __sparc__ \
102 || defined __powerpc__ || defined __x86_64__ || defined __sh__)
103 # define __ASSUME_CLONE_THREAD_FLAGS 1
104 #endif
105
106 /* Beginning with 2.5.63 support for realtime and monotonic clocks and
107 timers based on them is available. */
108 #define __ASSUME_POSIX_TIMERS 1
109
110 /* Beginning with 2.6.12 the clock and timer supports CPU clocks. */
111 #define __ASSUME_POSIX_CPU_TIMERS 1
112
113 /* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
114 #define __ASSUME_STATFS64 1
115
116 /* The tgkill syscall was instroduced for i386 in 2.5.75. On x86-64,
117 sparc, SH, ppc, and ppc64 it was introduced in 2.6.0-test3. */
118 #if (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
119 || defined __sh__ || defined __sparc__)
120 # define __ASSUME_TGKILL 1
121 #endif
122
123 /* The utimes syscall has been available for some architectures
124 forever. For x86 it was introduced after 2.5.75, for x86-64,
125 ppc, and ppc64 it was introduced in 2.6.0-test3. */
126 #if defined __sparc__ \
127 || defined __i386__ \
128 || defined __x86_64__ \
129 || defined __powerpc__ \
130 || defined __sh__
131 # define __ASSUME_UTIMES 1
132 #endif
133
134 /* The fixed version of the posix_fadvise64 syscall appeared in
135 2.6.0-test3. At least for x86 and sparc. Powerpc support appeared
136 in 2.6.2, but for 32-bit userspace only. */
137 #if (defined __i386__ || defined __sparc__ \
138 || (defined __powerpc__ && !defined __powerpc64__))
139 # define __ASSUME_FADVISE64_64_SYSCALL 1
140 #endif
141
142 /* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector
143 SIMD (AKA Altivec, VMX) instructions and register state. This changes
144 the overall size of the sigcontext and adds the swapcontext syscall. */
145 #ifdef __powerpc__
146 # define __ASSUME_SWAPCONTEXT_SYSCALL 1
147 #endif
148
149 /* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12. */
150 #if defined __sparc__ && defined __arch64__
151 # define __ASSUME_STAT64_SYSCALL 1
152 #endif
153
154 /* pselect/ppoll were introduced just after 2.6.16-rc1. Due to the way
155 the kernel versions are advertised we can only rely on 2.6.17 to have
156 the code. On x86_64 and SH this appeared first in 2.6.19-rc1,
157 on ia64 in 2.6.22-rc1. */
158 #if __LINUX_KERNEL_VERSION >= 0x020611 \
159 && ((!defined __x86_64__ && !defined __sh__) \
160 || (__LINUX_KERNEL_VERSION >= 0x020613 \
161 && (defined __x86_64__ || defined __sh__)))
162 # define __ASSUME_PSELECT 1
163 # define __ASSUME_PPOLL 1
164 #endif
165
166 /* The *at syscalls were introduced just after 2.6.16-rc1. Due to the way the
167 kernel versions are advertised we can only rely on 2.6.17 to have
168 the code. On PPC they were introduced in 2.6.17-rc1,
169 on SH in 2.6.19-rc1. */
170 #if __LINUX_KERNEL_VERSION >= 0x020611 \
171 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
172 # define __ASSUME_ATFCTS 1
173 #endif
174
175 /* Support for inter-process robust mutexes was added in 2.6.17. */
176 #if __LINUX_KERNEL_VERSION >= 0x020611 \
177 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
178 # define __ASSUME_SET_ROBUST_LIST 1
179 #endif
180
181 /* Pessimistically assume that 2.6.18 introduced real handling of
182 large numbers of requests to readv and writev and that we don't
183 need a fallback. It likely worked for much longer. */
184 #if __LINUX_KERNEL_VERSION >= 0x020612
185 # define __ASSUME_COMPLETE_READV_WRITEV 1
186 #endif
187
188 /* Support for PI futexes was added in 2.6.18. */
189 #if __LINUX_KERNEL_VERSION >= 0x020612
190 # define __ASSUME_FUTEX_LOCK_PI 1
191 #endif
192
193 /* Support for utimensat syscall was added in 2.6.22, on SH
194 only after 2.6.22-rc1. */
195 #if __LINUX_KERNEL_VERSION >= 0x020616 \
196 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020617)
197 # define __ASSUME_UTIMENSAT 1
198 #endif
199
200 /* Support for private futexes was added in 2.6.22. */
201 #if __LINUX_KERNEL_VERSION >= 0x020616
202 # define __ASSUME_PRIVATE_FUTEX 1
203 #endif
204
205 /* Support for fallocate was added in 2.6.23, on s390
206 only after 2.6.23-rc1. */
207 #if __LINUX_KERNEL_VERSION >= 0x020617 \
208 && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618)
209 # define __ASSUME_FALLOCATE 1
210 #endif
211
212 /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
213 x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */
214 #if __LINUX_KERNEL_VERSION >= 0x020617 \
215 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
216 || defined __sparc__ || defined __s390__)
217 # define __ASSUME_O_CLOEXEC 1
218 #endif
219
220 /* Support for ADJ_OFFSET_SS_READ was added in 2.6.24. */
221 #if __LINUX_KERNEL_VERSION >= 0x020618
222 # define __ASSUME_ADJ_OFFSET_SS_READ 1
223 #endif
224
225 /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
226 x86-64, PPC, IA-64, and SPARC in 2.6.27. */
227 #if __LINUX_KERNEL_VERSION >= 0x02061b \
228 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
229 || defined __sparc__ || defined __s390__)
230 # define __ASSUME_SOCK_CLOEXEC 1
231 # define __ASSUME_IN_NONBLOCK 1
232 # define __ASSUME_PIPE2 1
233 # define __ASSUME_EVENTFD2 1
234 # define __ASSUME_SIGNALFD4 1
235 # define __ASSUME_DUP3 1
236 #endif
237
238 /* Support for the accept4 syscall was added in 2.6.28. */
239 #if __LINUX_KERNEL_VERSION >= 0x02061c \
240 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
241 || defined __sparc__ || defined __s390__)
242 # define __ASSUME_ACCEPT4 1
243 #endif
244
245 /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
246 #if __LINUX_KERNEL_VERSION >= 0x02061d
247 # define __ASSUME_FUTEX_CLOCK_REALTIME 1
248 #endif
249
250 /* Support for the AT_RANDOM auxiliary vector entry was added in 2.6.29. */
251 #if __LINUX_KERNEL_VERSION >= 0x02061d
252 # define __ASSUME_AT_RANDOM 1
253 #endif
254
255 /* Support for preadv and pwritev was added in 2.6.30. */
256 #if __LINUX_KERNEL_VERSION >= 0x02061e
257 # define __ASSUME_PREADV 1
258 # define __ASSUME_PWRITEV 1
259 #endif
260
261 /* Support for F_GETOWN_EX was introduced in 2.6.32. */
262 #if __LINUX_KERNEL_VERSION >= 0x020620
263 # define __ASSUME_F_GETOWN_EX 1
264 #endif
265
266 /* Support for the recvmmsg syscall was added in 2.6.33. */
267 #if __LINUX_KERNEL_VERSION >= 0x020621
268 # define __ASSUME_RECVMMSG 1
269 #endif
270
271 /* statfs fills in f_flags since 2.6.36. */
272 #if __LINUX_KERNEL_VERSION >= 0x020624
273 # define __ASSUME_STATFS_F_FLAGS 1
274 #endif
275
276 /* prlimit64 is available in 2.6.36. */
277 #if __LINUX_KERNEL_VERSION >= 0x020624
278 # define __ASSUME_PRLIMIT64 1
279 #endif
280
281 /* sendmmsg is available in 2.6.39. */
282 #if __LINUX_KERNEL_VERSION >= 0x020627
283 # define __ASSUME_SENDMMSG 1
284 #endif
285
286 /* getcpu is a syscall for x86-64 since 3.1. */
287 #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
288 # define __ASSUME_GETCPU_SYSCALL 1
289 #endif