foo
[glibc.git] / sysdeps / unix / sysv / linux / kernel-features.h
blob85fc2f1615658e13f6eba42e8d85c6f38a3c7396
1 /* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 1999-2014 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
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.
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.
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/>. */
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. */
23 #ifndef __LINUX_KERNEL_VERSION
24 /* We assume the worst; all kernels should be supported. */
25 # define __LINUX_KERNEL_VERSION 0
26 #endif
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.
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. */
40 /* The sendfile syscall was introduced in 2.2.0. */
41 #define __ASSUME_SENDFILE 1
43 /* Some architectures use the socketcall multiplexer for some or all
44 socket-related operations, via a socket.S file in glibc, instead of
45 separate syscalls. __ASSUME_SOCKETCALL is defined for such
46 architectures. */
48 /* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on
49 PPC introduced a correct IPC64. But PowerPC64 does not support a
50 separate 64-bit syscall, already 64-bit. */
51 #define __ASSUME_IPC64 1
53 /* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
54 and still does not have a 64-bit inode field. */
55 #define __ASSUME_ST_INO_64_BIT 1
57 /* The getdents64 syscall was introduced in 2.4.0-test7 (but later for
58 MIPS n32). */
59 #define __ASSUME_GETDENTS64_SYSCALL 1
61 /* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
62 #define __ASSUME_STATFS64 1
64 /* The utimes syscall has been available for some architectures
65 forever. For x86 it was introduced after 2.5.75, for x86-64,
66 ppc, and ppc64 it was introduced in 2.6.0-test3, for s390 it was
67 introduced in 2.6.21-rc5. */
68 #define __ASSUME_UTIMES 1
70 /* pselect/ppoll were introduced just after 2.6.16-rc1. On x86_64 and
71 SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */
72 #define __ASSUME_PSELECT 1
73 #define __ASSUME_PPOLL 1
75 /* The *at syscalls were introduced just after 2.6.16-rc1. On PPC
76 they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1. */
77 #define __ASSUME_ATFCTS 1
79 /* Support for inter-process robust mutexes was added in 2.6.17 (but
80 some architectures lack futex_atomic_cmpxchg_inatomic in some
81 configurations). */
82 #define __ASSUME_SET_ROBUST_LIST 1
84 /* Support for PI futexes was added in 2.6.18 (but some architectures
85 lack futex_atomic_cmpxchg_inatomic in some configurations). */
86 #define __ASSUME_FUTEX_LOCK_PI 1
88 /* Support for private futexes was added in 2.6.22. */
89 #define __ASSUME_PRIVATE_FUTEX 1
91 /* Support for fallocate was added in 2.6.23, on s390
92 only after 2.6.23-rc1. */
93 #define __ASSUME_FALLOCATE 1
95 /* Support for various CLOEXEC and NONBLOCK flags was added in
96 2.6.23. */
97 #define __ASSUME_O_CLOEXEC 1
99 /* Support for various CLOEXEC and NONBLOCK flags was added in
100 2.6.27. */
101 #define __ASSUME_SOCK_CLOEXEC 1
102 #define __ASSUME_IN_NONBLOCK 1
103 #define __ASSUME_PIPE2 1
104 #define __ASSUME_EVENTFD2 1
105 #define __ASSUME_SIGNALFD4 1
106 #define __ASSUME_DUP3 1
108 /* Support for accept4 functionality was added in 2.6.28, but for some
109 architectures using a separate syscall rather than socketcall that
110 syscall was only added later, and some architectures first had
111 socketcall support then a separate syscall. Define
112 __ASSUME_ACCEPT4_SOCKETCALL if glibc uses socketcall on this
113 architecture and accept4 is available through socketcall,
114 __ASSUME_ACCEPT4_SYSCALL if it is available through a separate
115 syscall, __ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL if it became
116 available through a separate syscall at the same time as through
117 socketcall, and __ASSUME_ACCEPT4 if the accept4 function is known
118 to work. */
119 #ifdef __ASSUME_SOCKETCALL
120 # define __ASSUME_ACCEPT4_SOCKETCALL 1
121 #endif
123 #if defined __ASSUME_ACCEPT4_SOCKETCALL || defined __ASSUME_ACCEPT4_SYSCALL
124 # define __ASSUME_ACCEPT4 1
125 #endif
127 /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
128 #define __ASSUME_FUTEX_CLOCK_REALTIME 1
130 /* Support for preadv and pwritev was added in 2.6.30. */
131 #define __ASSUME_PREADV 1
132 #define __ASSUME_PWRITEV 1
134 /* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31 (but some
135 architectures lack futex_atomic_cmpxchg_inatomic in some
136 configurations). */
137 #define __ASSUME_REQUEUE_PI 1
139 /* Support for recvmmsg functionality was added in 2.6.33. The macros
140 defined correspond to those for accept4. */
141 #if __LINUX_KERNEL_VERSION >= 0x020621 && defined __ASSUME_SOCKETCALL
142 # define __ASSUME_RECVMMSG_SOCKETCALL 1
143 #endif
145 #if defined __ASSUME_RECVMMSG_SOCKETCALL || defined __ASSUME_RECVMMSG_SYSCALL
146 # define __ASSUME_RECVMMSG 1
147 #endif
149 /* Support for /proc/self/task/$tid/comm and /proc/$pid/task/$tid/comm was
150 added in 2.6.33. */
151 #if __LINUX_KERNEL_VERSION >= 0x020621
152 # define __ASSUME_PROC_PID_TASK_COMM 1
153 #endif
155 /* statfs fills in f_flags since 2.6.36. */
156 #if __LINUX_KERNEL_VERSION >= 0x020624
157 # define __ASSUME_STATFS_F_FLAGS 1
158 #endif
160 /* prlimit64 is available in 2.6.36. */
161 #if __LINUX_KERNEL_VERSION >= 0x020624
162 # define __ASSUME_PRLIMIT64 1
163 #endif
165 /* Support for sendmmsg functionality was added in 3.0. The macros
166 defined correspond to those for accept4 and recvmmsg. */
167 #if __LINUX_KERNEL_VERSION >= 0x030000 && defined __ASSUME_SOCKETCALL
168 # define __ASSUME_SENDMMSG_SOCKETCALL 1
169 #endif
171 #if defined __ASSUME_SENDMMSG_SOCKETCALL || defined __ASSUME_SENDMMSG_SYSCALL
172 # define __ASSUME_SENDMMSG 1
173 #endif