]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/kernel-features.h
Remove __ASSUME_STAT64_SYSCALL.
[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 /* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on
44 PPC introduced a correct IPC64. But PowerPC64 does not support a
45 separate 64-bit syscall, already 64-bit. */
46 #ifndef __powerpc64__
47 # define __ASSUME_IPC64 1
48 #endif
49
50 /* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
51 and still does not have a 64-bit inode field. */
52 #ifndef __sh__
53 # define __ASSUME_ST_INO_64_BIT 1
54 #endif
55
56 /* The getdents64 syscall was introduced in 2.4.0-test7 (but later for
57 MIPS n32). */
58 #define __ASSUME_GETDENTS64_SYSCALL 1
59
60 /* Beginning with 2.6.12 the clock and timer supports CPU clocks. */
61 #define __ASSUME_POSIX_CPU_TIMERS 1
62
63 /* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
64 #define __ASSUME_STATFS64 1
65
66 /* The utimes syscall has been available for some architectures
67 forever. For x86 it was introduced after 2.5.75, for x86-64,
68 ppc, and ppc64 it was introduced in 2.6.0-test3, for s390 it was
69 introduced in 2.6.21-rc5. */
70 #if defined __sparc__ \
71 || defined __i386__ \
72 || defined __x86_64__ \
73 || defined __powerpc__ \
74 || defined __sh__ \
75 || (defined __s390__ && __LINUX_KERNEL_VERSION >= 0x020616)
76 # define __ASSUME_UTIMES 1
77 #endif
78
79 /* pselect/ppoll were introduced just after 2.6.16-rc1. Due to the way
80 the kernel versions are advertised we can only rely on 2.6.17 to have
81 the code. On x86_64 and SH this appeared first in 2.6.19-rc1,
82 on ia64 in 2.6.22-rc1. */
83 #if __LINUX_KERNEL_VERSION >= 0x020611 \
84 && ((!defined __x86_64__ && !defined __sh__) \
85 || (__LINUX_KERNEL_VERSION >= 0x020613 \
86 && (defined __x86_64__ || defined __sh__)))
87 # define __ASSUME_PSELECT 1
88 # define __ASSUME_PPOLL 1
89 #endif
90
91 /* The *at syscalls were introduced just after 2.6.16-rc1. Due to the way the
92 kernel versions are advertised we can only rely on 2.6.17 to have
93 the code. On PPC they were introduced in 2.6.17-rc1,
94 on SH in 2.6.19-rc1. */
95 #if __LINUX_KERNEL_VERSION >= 0x020611 \
96 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
97 # define __ASSUME_ATFCTS 1
98 #endif
99
100 /* Support for inter-process robust mutexes was added in 2.6.17. */
101 #if __LINUX_KERNEL_VERSION >= 0x020611 \
102 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
103 # define __ASSUME_SET_ROBUST_LIST 1
104 #endif
105
106 /* Pessimistically assume that 2.6.18 introduced real handling of
107 large numbers of requests to readv and writev and that we don't
108 need a fallback. It likely worked for much longer. */
109 #if __LINUX_KERNEL_VERSION >= 0x020612
110 # define __ASSUME_COMPLETE_READV_WRITEV 1
111 #endif
112
113 /* Support for PI futexes was added in 2.6.18. */
114 #if __LINUX_KERNEL_VERSION >= 0x020612
115 # define __ASSUME_FUTEX_LOCK_PI 1
116 #endif
117
118 /* Support for utimensat syscall was added in 2.6.22, on SH
119 only after 2.6.22-rc1. */
120 #if __LINUX_KERNEL_VERSION >= 0x020616 \
121 && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020617)
122 # define __ASSUME_UTIMENSAT 1
123 #endif
124
125 /* Support for private futexes was added in 2.6.22. */
126 #if __LINUX_KERNEL_VERSION >= 0x020616
127 # define __ASSUME_PRIVATE_FUTEX 1
128 #endif
129
130 /* Support for fallocate was added in 2.6.23, on s390
131 only after 2.6.23-rc1. */
132 #if __LINUX_KERNEL_VERSION >= 0x020617 \
133 && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618)
134 # define __ASSUME_FALLOCATE 1
135 #endif
136
137 /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
138 x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */
139 #if __LINUX_KERNEL_VERSION >= 0x020617 \
140 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
141 || defined __sparc__ || defined __s390__)
142 # define __ASSUME_O_CLOEXEC 1
143 #endif
144
145 /* From 2.6.23 onwards the value of ARG_MAX depends on the stack
146 size. */
147 #define __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL 0x020617
148 #if __LINUX_KERNEL_VERSION >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL
149 # define __ASSUME_ARG_MAX_STACK_BASED 1
150 #endif
151
152 /* Support for ADJ_OFFSET_SS_READ was added in 2.6.24. */
153 #if __LINUX_KERNEL_VERSION >= 0x020618
154 # define __ASSUME_ADJ_OFFSET_SS_READ 1
155 #endif
156
157 /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
158 x86-64, PPC, IA-64, and SPARC in 2.6.27. */
159 #if __LINUX_KERNEL_VERSION >= 0x02061b \
160 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
161 || defined __sparc__ || defined __s390__)
162 # define __ASSUME_SOCK_CLOEXEC 1
163 # define __ASSUME_IN_NONBLOCK 1
164 # define __ASSUME_PIPE2 1
165 # define __ASSUME_EVENTFD2 1
166 # define __ASSUME_SIGNALFD4 1
167 # define __ASSUME_DUP3 1
168 #endif
169
170 /* Support for the accept4 syscall was added in 2.6.28. */
171 #if __LINUX_KERNEL_VERSION >= 0x02061c \
172 && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
173 || defined __sparc__ || defined __s390__)
174 # define __ASSUME_ACCEPT4 1
175 #endif
176
177 /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
178 #if __LINUX_KERNEL_VERSION >= 0x02061d
179 # define __ASSUME_FUTEX_CLOCK_REALTIME 1
180 #endif
181
182 /* Support for the AT_RANDOM auxiliary vector entry was added in 2.6.29. */
183 #if __LINUX_KERNEL_VERSION >= 0x02061d
184 # define __ASSUME_AT_RANDOM 1
185 #endif
186
187 /* Support for preadv and pwritev was added in 2.6.30. */
188 #if __LINUX_KERNEL_VERSION >= 0x02061e
189 # define __ASSUME_PREADV 1
190 # define __ASSUME_PWRITEV 1
191 #endif
192
193 /* Support for F_GETOWN_EX was introduced in 2.6.32. */
194 #if __LINUX_KERNEL_VERSION >= 0x020620
195 # define __ASSUME_F_GETOWN_EX 1
196 #endif
197
198 /* Support for the recvmmsg syscall was added in 2.6.33. */
199 #if __LINUX_KERNEL_VERSION >= 0x020621
200 # define __ASSUME_RECVMMSG 1
201 #endif
202
203 /* statfs fills in f_flags since 2.6.36. */
204 #if __LINUX_KERNEL_VERSION >= 0x020624
205 # define __ASSUME_STATFS_F_FLAGS 1
206 #endif
207
208 /* prlimit64 is available in 2.6.36. */
209 #if __LINUX_KERNEL_VERSION >= 0x020624
210 # define __ASSUME_PRLIMIT64 1
211 #endif
212
213 /* sendmmsg is available in 2.6.39. */
214 #if __LINUX_KERNEL_VERSION >= 0x020627
215 # define __ASSUME_SENDMMSG 1
216 #endif
217
218 /* getcpu is a syscall for x86-64 since 3.1. */
219 #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
220 # define __ASSUME_GETCPU_SYSCALL 1
221 #endif