]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/kernel-features.h
* sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: New. * sysdeps/unix/sysv...
[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.
ad0e8eb0 3 Copyright (C) 1999, 2000, 2001, 2002, 2003 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
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. */
958f238f
UD
20
21/* This file must not contain any C code. At least it must be protected
22 to allow using the file also in assembler files. */
23
958f238f
UD
24#ifndef __LINUX_KERNEL_VERSION
25/* We assume the worst; all kernels should be supported. */
26# define __LINUX_KERNEL_VERSION 0
27#endif
28
29/* We assume for __LINUX_KERNEL_VERSION the same encoding used in
30 linux/version.h. I.e., the major, minor, and subminor all get a
31 byte with the major number being in the highest byte. This means
32 we can do numeric comparisons.
33
34 In the following we will define certain symbols depending on
35 whether the describes kernel feature is available in the kernel
36 version given by __LINUX_KERNEL_VERSION. We are not always exactly
37 recording the correct versions in which the features were
38 introduced. If somebody cares these values can afterwards be
39 corrected. Most of the numbers here are set corresponding to
40 2.2.0. */
41
42/* `getcwd' system call. */
43#if __LINUX_KERNEL_VERSION >= 131584
44# define __ASSUME_GETCWD_SYSCALL 1
45#endif
46
47/* Real-time signal became usable in 2.1.70. */
48#if __LINUX_KERNEL_VERSION >= 131398
49# define __ASSUME_REALTIME_SIGNALS 1
50#endif
51
52/* When were the `pread'/`pwrite' syscalls introduced? */
53#if __LINUX_KERNEL_VERSION >= 131584
54# define __ASSUME_PREAD_SYSCALL 1
55# define __ASSUME_PWRITE_SYSCALL 1
56#endif
57
58/* When was `poll' introduced? */
59#if __LINUX_KERNEL_VERSION >= 131584
60# define __ASSUME_POLL_SYSCALL 1
61#endif
62
63/* The `lchown' syscall was introduced in 2.1.80. */
64#if __LINUX_KERNEL_VERSION >= 131408
65# define __ASSUME_LCHOWN_SYSCALL 1
66#endif
67
68/* When did the `setresuid' sysall became available? */
0482576e 69#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__
958f238f
UD
70# define __ASSUME_SETRESUID_SYSCALL 1
71#endif
9a8fcca0
UD
72
73/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */
74#if __LINUX_KERNEL_VERSION >= 131408
75# define __ASSUME_SIOCGIFNAME 1
76#endif
ecda4bda
UD
77
78/* On x86 another `getrlimit' syscall was added in 2.3.25. */
79#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__
80# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
81#endif
d587d83b
UD
82
83/* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */
84#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__
85# define __ASSUME_TRUNCATE64_SYSCALL 1
86#endif
87
63a34b0f 88/* On x86 the mmap2 syscall was introduced in 2.3.31. */
d587d83b
UD
89#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__
90# define __ASSUME_MMAP2_SYSCALL 1
91#endif
63a34b0f
UD
92
93/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */
94#if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__
95# define __ASSUME_STAT64_SYSCALL 1
96#endif
29332175 97
e3aaaa27 98/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
29332175 99 syscalls were introduced in 2.3.35. */
e3aaaa27 100#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__)
29332175
UD
101# define __ASSUME_TRUNCATE64_SYSCALL 1
102# define __ASSUME_MMAP2_SYSCALL 1
103# define __ASSUME_STAT64_SYSCALL 1
104#endif
313fed01 105
51a8c49d 106/* I know for sure that getrlimit are in 2.3.35 on powerpc. */
053cc7bb 107#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__
51a8c49d
RM
108# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
109#endif
110
330fad29 111/* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not
51a8c49d
RM
112 support separate 64-bit syscalls, already 64-bit */
113#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ \
114 && !defined __powerpc64__
053cc7bb
GK
115# define __ASSUME_TRUNCATE64_SYSCALL 1
116# define __ASSUME_STAT64_SYSCALL 1
053cc7bb
GK
117#endif
118
51a8c49d 119/* Linux 2.3.39 introduced 32bit UID/GIDs. Some platforms had 32
a0386a0d 120 bit type all along. */
c5e38fac 121#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__
313fed01
UD
122# define __ASSUME_32BITUIDS 1
123#endif
a074fa3c 124
51a8c49d
RM
125/* Linux 2.3.39 sparc added setresuid. */
126#if __LINUX_KERNEL_VERSION >= 131879 && defined __sparc__
330fad29 127# define __ASSUME_SETRESUID_SYSCALL 1
51a8c49d
RM
128#endif
129
130/* Linux 2.3.39 introduced IPC64. Except for powerpc. */
131#if __LINUX_KERNEL_VERSION >= 131879 && !defined __powerpc__
132# define __ASSUME_IPC64 1
133#endif
134
135/* mips platforms had IPC64 all along. */
136#if defined __mips__
137# define __ASSUME_IPC64 1
138#endif
139
330fad29 140/* Linux 2.4.0 on PPC introduced a correct IPC64. But PowerPC64 does not
51a8c49d
RM
141 support a separate 64-bit sys call, already 64-bit */
142#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ \
143 && !defined __powerpc64__
a0386a0d
UD
144# define __ASSUME_IPC64 1
145#endif
146
a074fa3c
AJ
147/* We can use the LDTs for threading with Linux 2.3.99 and newer. */
148#if __LINUX_KERNEL_VERSION >= 131939
149# define __ASSUME_LDT_WORKS 1
150#endif
56ddf355
UD
151
152/* The changed st_ino field appeared in 2.4.0-test6. But we cannot
153 distinguish this version from other 2.4.0 releases. Therefore play
4863ed87 154 save and assume it available is for 2.4.1 and up. */
56ddf355
UD
155#if __LINUX_KERNEL_VERSION >= 132097
156# define __ASSUME_ST_INO_64_BIT 1
157#endif
21f6a100
UD
158
159/* To support locking of large files a new fcntl() syscall was introduced
160 in 2.4.0-test7. We test for 2.4.1 for the earliest version we know
161 the syscall is available. */
f39b19c7 162#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__)
21f6a100
UD
163# define __ASSUME_FCNTL64 1
164#endif
14860991 165
d37286c1 166/* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I
51a8c49d
RM
167 don't know when it got introduced). But PowerPC64 does not support
168 separate FCNTL64 call, FCNTL is already 64-bit */
5ee5d791 169#if __LINUX_KERNEL_VERSION >= 132100 \
51a8c49d
RM
170 && (defined __arm__ || defined __powerpc__ || defined __sh__) \
171 && !defined __powerpc64__
d37286c1
AJ
172# define __ASSUME_FCNTL64 1
173#endif
174
14860991
UD
175/* The getdents64 syscall was introduced in 2.4.0-test7. We test for
176 2.4.1 for the earliest version we know the syscall is available. */
177#if __LINUX_KERNEL_VERSION >= 132097
178# define __ASSUME_GETDENTS64_SYSCALL 1
179#endif
675e4015
UD
180
181/* When did O_DIRECTORY became available? Early in 2.3 but when?
182 Be safe, use 2.3.99. */
183#if __LINUX_KERNEL_VERSION >= 131939
7060e53e 184# define __ASSUME_O_DIRECTORY 1
675e4015 185#endif
4e56fdbc
UD
186
187/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
188 up the page size information. */
189#if __LINUX_KERNEL_VERSION >= 132097
7060e53e 190# define __ASSUME_AT_PAGESIZE 1
4e56fdbc 191#endif
390911be 192
846c6907
UD
193/* Starting with at least 2.4.0 the kernel passes the uid/gid unconditionally
194 up to the child. */
195#if __LINUX_KERNEL_VERSION >= 132097
196# define __ASSUME_AT_XID 1
197#endif
198
b398ae3c
UD
199/* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way
200 and the vfork syscall made it into the official kernel. */
7060e53e
AJ
201#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__
202# define __ASSUME_STD_AUXV 1
b398ae3c 203# define __ASSUME_VFORK_SYSCALL 1
51a8c49d
RM
204#endif
205
206/* Starting with 2.4.5 kernels the mmap2 syscall made it into the official
207 kernel. But PowerPC64 does not support a separate MMAP2 call. */
208#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ \
209 && !defined __powerpc64__
7060e53e 210# define __ASSUME_MMAP2_SYSCALL 1
390911be 211#endif
c5e38fac 212
05856976 213/* Starting with 2.4.21 PowerPC implements the new prctl syscall.
38e68573 214 This allows applications to get/set the Floating Point Exception Mode. */
05856976 215#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc__
38e68573
UD
216# define __ASSUME_NEW_PRCTL_SYSCALL 1
217#endif
218
219/* Starting with 2.4.21 PowerPC64 implements the new rt_sigreturn syscall.
220 The new rt_sigreturn takes an ucontext pointer allowing rt_sigreturn
221 to be used in the set/swapcontext implementation. */
222#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc64__
223# define __ASSUME_NEW_RT_SIGRETURN_SYSCALL 1
224#endif
225
0950889b 226/* On x86, the set_thread_area syscall was introduced in 2.5.29, but its
05a51227 227 semantics was changed in 2.5.30, and again after 2.5.31. */
2a76f7ef 228#if __LINUX_KERNEL_VERSION >= 132384 && defined __i386__
0950889b
UD
229# define __ASSUME_SET_THREAD_AREA_SYSCALL 1
230#endif
231
8eed661a
RM
232/* The vfork syscall on x86 and arm was definitely available in 2.4. */
233#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__)
885bc024
UD
234# define __ASSUME_VFORK_SYSCALL 1
235#endif
236
c5e38fac
UD
237/* There are an infinite number of PA-RISC kernel versions numbered
238 2.4.0. But they've not really been released as such. We require
239 and expect the final version here. */
240#ifdef __hppa__
241# define __ASSUME_32BITUIDS 1
242# define __ASSUME_TRUNCATE64_SYSCALL 1
243# define __ASSUME_MMAP2_SYSCALL 1
244# define __ASSUME_STAT64_SYSCALL 1
245# define __ASSUME_IPC64 1
246# define __ASSUME_ST_INO_64_BIT 1
247# define __ASSUME_FCNTL64 1
248# define __ASSUME_GETDENTS64_SYSCALL 1
249#endif
7d092b69 250
743f1874
AO
251#if defined __mips__ && defined _ABIN32 && _MIPS_SIM == _ABIN32
252# define __ASSUME_FCNTL64 1
253#endif
254
7d092b69
UD
255/* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize
256 their availability with one define. The changes were made first
257 for i386 and the have to be done separately for the other archs.
258 For i386 we pick 2.5.50 as the first version with support. */
74e8f2dc 259#if __LINUX_KERNEL_VERSION >= 132402 && defined __i386__
7d092b69
UD
260# define __ASSUME_CLONE_THREAD_FLAGS 1
261#endif
c2918f01
AS
262
263/* These features were surely available with 2.4.12. */
264#if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
265# define __ASSUME_MMAP2_SYSCALL 1
266# define __ASSUME_TRUNCATE64_SYSCALL 1
267# define __ASSUME_STAT64_SYSCALL 1
268# define __ASSUME_FCNTL64 1
269# define __ASSUME_VFORK_SYSCALL 1
270#endif
ad0e8eb0
UD
271
272/* Beginning with 2.5.63 support for realtime and monotonic clocks and
273 timers based on them is available. */
274#if __LINUX_KERNEL_VERSION >= 132415
275# define __ASSUME_POSIX_TIMERS 1
276#endif
f006d3a0
UD
277
278/* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize
279 their availability with one define. The changes were made first
280 for i386 and the have to be done separately for the other archs.
7eecc0c2 281 For ia64, s390*, PPC we pick 2.5.64 as the first version with support. */
f006d3a0 282#if __LINUX_KERNEL_VERSION >= 132416 \
7eecc0c2 283 && (defined __ia64__ || defined __s390__ || defined __powerpc__)
f006d3a0
UD
284# define __ASSUME_CLONE_THREAD_FLAGS 1
285#endif
e0c09a43
UD
286
287/* With kernel 2.4.17 we always have netlink support. */
288#if __LINUX_KERNEL_VERSION >= (132096+17)
289# define __ASSUME_NETLINK_SUPPORT 1
290#endif
291