1 | /* Set flags signalling availability of kernel features based on given |
2 | kernel version number. |
3 | Copyright (C) 1999-2016 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 | /* Some architectures use the socketcall multiplexer for some or all |
44 | socket-related operations instead of separate syscalls. |
45 | __ASSUME_SOCKETCALL is defined for such architectures. */ |
46 | |
47 | /* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame, |
48 | and still does not have a 64-bit inode field. */ |
49 | #define __ASSUME_ST_INO_64_BIT 1 |
50 | |
51 | /* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */ |
52 | #define __ASSUME_STATFS64 1 |
53 | |
54 | /* pselect/ppoll were introduced just after 2.6.16-rc1. On x86_64 and |
55 | SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */ |
56 | #define __ASSUME_PSELECT 1 |
57 | |
58 | /* The *at syscalls were introduced just after 2.6.16-rc1. On PPC |
59 | they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1. */ |
60 | #define __ASSUME_ATFCTS 1 |
61 | |
62 | /* Support for inter-process robust mutexes was added in 2.6.17 (but |
63 | some architectures lack futex_atomic_cmpxchg_inatomic in some |
64 | configurations). */ |
65 | #define __ASSUME_SET_ROBUST_LIST 1 |
66 | |
67 | /* Support for private futexes was added in 2.6.22. */ |
68 | #define __ASSUME_PRIVATE_FUTEX 1 |
69 | |
70 | /* Support for various CLOEXEC and NONBLOCK flags was added in |
71 | 2.6.23. */ |
72 | #define __ASSUME_O_CLOEXEC 1 |
73 | |
74 | /* Support for various CLOEXEC and NONBLOCK flags was added in |
75 | 2.6.27. */ |
76 | #define __ASSUME_IN_NONBLOCK 1 |
77 | #define __ASSUME_PIPE2 1 |
78 | #define __ASSUME_DUP3 1 |
79 | |
80 | /* Support for accept4 functionality was added in 2.6.28, but for some |
81 | architectures using a separate syscall rather than socketcall that |
82 | syscall was only added later, and some architectures first had |
83 | socketcall support then a separate syscall. Define |
84 | __ASSUME_ACCEPT4_SOCKETCALL if glibc uses socketcall on this |
85 | architecture and accept4 is available through socketcall, |
86 | __ASSUME_ACCEPT4_SYSCALL if it is available through a separate |
87 | syscall, __ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL if it became |
88 | available through a separate syscall at the same time as through |
89 | socketcall, and __ASSUME_ACCEPT4 if the accept4 function is known |
90 | to work. */ |
91 | #ifdef __ASSUME_SOCKETCALL |
92 | # define __ASSUME_ACCEPT4_SOCKETCALL 1 |
93 | #endif |
94 | #define __ASSUME_ACCEPT4_SYSCALL 1 |
95 | #define __ASSUME_ACCEPT4 1 |
96 | |
97 | /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */ |
98 | #define __ASSUME_FUTEX_CLOCK_REALTIME 1 |
99 | |
100 | /* Support for preadv and pwritev was added in 2.6.30. */ |
101 | #define __ASSUME_PREADV 1 |
102 | #define __ASSUME_PWRITEV 1 |
103 | |
104 | /* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31 (but some |
105 | architectures lack futex_atomic_cmpxchg_inatomic in some |
106 | configurations). */ |
107 | #define __ASSUME_REQUEUE_PI 1 |
108 | |
109 | /* Support for recvmmsg functionality was added in 2.6.33. The macros |
110 | defined correspond to those for accept4. */ |
111 | #if __LINUX_KERNEL_VERSION >= 0x020621 |
112 | # ifdef __ASSUME_SOCKETCALL |
113 | # define __ASSUME_RECVMMSG_SOCKETCALL 1 |
114 | # endif |
115 | # define __ASSUME_RECVMMSG_SYSCALL 1 |
116 | # define __ASSUME_RECVMMSG 1 |
117 | #endif |
118 | |
119 | /* Support for /proc/self/task/$tid/comm and /proc/$pid/task/$tid/comm was |
120 | added in 2.6.33. */ |
121 | #if __LINUX_KERNEL_VERSION >= 0x020621 |
122 | # define __ASSUME_PROC_PID_TASK_COMM 1 |
123 | #endif |
124 | |
125 | /* statfs fills in f_flags since 2.6.36. */ |
126 | #if __LINUX_KERNEL_VERSION >= 0x020624 |
127 | # define __ASSUME_STATFS_F_FLAGS 1 |
128 | #endif |
129 | |
130 | /* prlimit64 is available in 2.6.36. */ |
131 | #if __LINUX_KERNEL_VERSION >= 0x020624 |
132 | # define __ASSUME_PRLIMIT64 1 |
133 | #endif |
134 | |
135 | /* Support for sendmmsg functionality was added in 3.0. The macros |
136 | defined correspond to those for accept4 and recvmmsg. */ |
137 | #if __LINUX_KERNEL_VERSION >= 0x030000 |
138 | # ifdef __ASSUME_SOCKETCALL |
139 | # define __ASSUME_SENDMMSG_SOCKETCALL 1 |
140 | # endif |
141 | # define __ASSUME_SENDMMSG_SYSCALL 1 |
142 | # define __ASSUME_SENDMMSG 1 |
143 | #endif |
144 | |
145 | /* On most architectures, most socket syscalls are supported for all |
146 | supported kernel versions, but on some socketcall architectures |
147 | separate syscalls were only added later. */ |
148 | #define __ASSUME_SENDMSG_SYSCALL 1 |
149 | #define __ASSUME_RECVMSG_SYSCALL 1 |
150 | |