kernel-features.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. /* Set flags signalling availability of kernel features based on given
  2. kernel version number.
  3. Copyright (C) 1999-2003, 2004, 2005 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. /* This file must not contain any C code. At least it must be protected
  17. to allow using the file also in assembler files. */
  18. #if defined __mips__
  19. # include <sgidefs.h>
  20. #endif
  21. #include <linux/version.h>
  22. #define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE
  23. /* We assume for __LINUX_KERNEL_VERSION the same encoding used in
  24. linux/version.h. I.e., the major, minor, and subminor all get a
  25. byte with the major number being in the highest byte. This means
  26. we can do numeric comparisons.
  27. In the following we will define certain symbols depending on
  28. whether the describes kernel feature is available in the kernel
  29. version given by __LINUX_KERNEL_VERSION. We are not always exactly
  30. recording the correct versions in which the features were
  31. introduced. If somebody cares these values can afterwards be
  32. corrected. Most of the numbers here are set corresponding to
  33. 2.2.0. */
  34. /* `getcwd' system call. */
  35. #if __LINUX_KERNEL_VERSION >= 131584
  36. # define __ASSUME_GETCWD_SYSCALL 1
  37. #endif
  38. /* When was `poll' introduced? */
  39. #if __LINUX_KERNEL_VERSION >= 131584
  40. # define __ASSUME_POLL_SYSCALL 1
  41. #endif
  42. /* Real-time signal became usable in 2.1.70. */
  43. #if __LINUX_KERNEL_VERSION >= 131398
  44. # define __ASSUME_REALTIME_SIGNALS 1
  45. #endif
  46. /* When were the `pread'/`pwrite' syscalls introduced? */
  47. #if __LINUX_KERNEL_VERSION >= 131584
  48. # define __ASSUME_PREAD_SYSCALL 1
  49. # define __ASSUME_PWRITE_SYSCALL 1
  50. #endif
  51. /* When was `poll' introduced? */
  52. #if __LINUX_KERNEL_VERSION >= 131584
  53. # define __ASSUME_POLL_SYSCALL 1
  54. #endif
  55. /* The `lchown' syscall was introduced in 2.1.80. */
  56. #if __LINUX_KERNEL_VERSION >= 131408
  57. # define __ASSUME_LCHOWN_SYSCALL 1
  58. #endif
  59. /* When did the `setresuid' sysall became available? */
  60. #if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__
  61. # define __ASSUME_SETRESUID_SYSCALL 1
  62. #endif
  63. /* The SIOCGIFNAME ioctl is available starting with 2.1.50. */
  64. #if __LINUX_KERNEL_VERSION >= 131408
  65. # define __ASSUME_SIOCGIFNAME 1
  66. #endif
  67. /* MSG_NOSIGNAL was at least available with Linux 2.2.0. */
  68. #if __LINUX_KERNEL_VERSION >= 131584
  69. # define __ASSUME_MSG_NOSIGNAL 1
  70. #endif
  71. /* On x86 another `getrlimit' syscall was added in 2.3.25. */
  72. #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__
  73. # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
  74. #endif
  75. /* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */
  76. #if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__
  77. # define __ASSUME_TRUNCATE64_SYSCALL 1
  78. #endif
  79. /* On x86 the mmap2 syscall was introduced in 2.3.31. */
  80. #if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__
  81. # define __ASSUME_MMAP2_SYSCALL 1
  82. #endif
  83. /* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */
  84. #if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__
  85. # define __ASSUME_STAT64_SYSCALL 1
  86. #endif
  87. /* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
  88. syscalls were introduced in 2.3.35. */
  89. #if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__)
  90. # define __ASSUME_TRUNCATE64_SYSCALL 1
  91. # define __ASSUME_MMAP2_SYSCALL 1
  92. # define __ASSUME_STAT64_SYSCALL 1
  93. #endif
  94. /* I know for sure that getrlimit are in 2.3.35 on powerpc. */
  95. #if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__
  96. # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
  97. #endif
  98. /* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not
  99. support separate 64-bit syscalls, already 64-bit */
  100. #if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ \
  101. && !defined __powerpc64__
  102. # define __ASSUME_TRUNCATE64_SYSCALL 1
  103. # define __ASSUME_STAT64_SYSCALL 1
  104. #endif
  105. /* Linux 2.3.39 introduced 32bit UID/GIDs. Some platforms had 32
  106. bit type all along. */
  107. #if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__
  108. # define __ASSUME_32BITUIDS 1
  109. #endif
  110. /* Linux 2.3.39 sparc added setresuid. */
  111. #if __LINUX_KERNEL_VERSION >= 131879 && defined __sparc__
  112. # define __ASSUME_SETRESUID_SYSCALL 1
  113. #endif
  114. #if __LINUX_KERNEL_VERSION >= 131879
  115. # define __ASSUME_SETRESGID_SYSCALL 1
  116. #endif
  117. /* Linux 2.3.39 introduced IPC64. Except for powerpc. */
  118. #if __LINUX_KERNEL_VERSION >= 131879 && !defined __powerpc__
  119. # define __ASSUME_IPC64 1
  120. #endif
  121. /* MIPS platforms had IPC64 all along. */
  122. #if defined __mips__
  123. # define __ASSUME_IPC64 1
  124. #endif
  125. /* We can use the LDTs for threading with Linux 2.3.99 and newer. */
  126. #if __LINUX_KERNEL_VERSION >= 131939
  127. # define __ASSUME_LDT_WORKS 1
  128. #endif
  129. /* Linux 2.4.0 on PPC introduced a correct IPC64. But PowerPC64 does not
  130. support a separate 64-bit sys call, already 64-bit */
  131. #if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ \
  132. && !defined __powerpc64__
  133. # define __ASSUME_IPC64 1
  134. #endif
  135. /* SH kernels got stat64, mmap2, and truncate64 during 2.4.0-test. */
  136. #if __LINUX_KERNEL_VERSION >= 132096 && defined __sh__
  137. # define __ASSUME_TRUNCATE64_SYSCALL 1
  138. # define __ASSUME_MMAP2_SYSCALL 1
  139. # define __ASSUME_STAT64_SYSCALL 1
  140. #endif
  141. /* The changed st_ino field appeared in 2.4.0-test6. But we cannot
  142. distinguish this version from other 2.4.0 releases. Therefore play
  143. save and assume it available is for 2.4.1 and up. However, SH is lame,
  144. and still does not have a 64-bit inode field. */
  145. #if __LINUX_KERNEL_VERSION >= 132097 && !defined __alpha__ && !defined __sh__
  146. # define __ASSUME_ST_INO_64_BIT 1
  147. #endif
  148. /* To support locking of large files a new fcntl() syscall was introduced
  149. in 2.4.0-test7. We test for 2.4.1 for the earliest version we know
  150. the syscall is available. */
  151. #if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__)
  152. # define __ASSUME_FCNTL64 1
  153. #endif
  154. /* The AT_CLKTCK auxiliary vector entry was introduction in the 2.4.0
  155. series. */
  156. #if __LINUX_KERNEL_VERSION >= 132097
  157. # define __ASSUME_AT_CLKTCK 1
  158. #endif
  159. /* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I
  160. don't know when it got introduced). But PowerPC64 does not support
  161. separate FCNTL64 call, FCNTL is already 64-bit */
  162. #if __LINUX_KERNEL_VERSION >= 132100 \
  163. && (defined __arm__ || defined __powerpc__ || defined __sh__) \
  164. && !defined __powerpc64__
  165. # define __ASSUME_FCNTL64 1
  166. #endif
  167. /* The getdents64 syscall was introduced in 2.4.0-test7. We test for
  168. 2.4.1 for the earliest version we know the syscall is available. */
  169. #if __LINUX_KERNEL_VERSION >= 132097
  170. # define __ASSUME_GETDENTS64_SYSCALL 1
  171. #endif
  172. /* When did O_DIRECTORY became available? Early in 2.3 but when?
  173. Be safe, use 2.3.99. */
  174. #if __LINUX_KERNEL_VERSION >= 131939
  175. # define __ASSUME_O_DIRECTORY 1
  176. #endif
  177. /* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
  178. up the page size information. */
  179. #if __LINUX_KERNEL_VERSION >= 132097
  180. # define __ASSUME_AT_PAGESIZE 1
  181. #endif
  182. /* Starting with at least 2.4.0 the kernel passes the uid/gid unconditionally
  183. up to the child. */
  184. #if __LINUX_KERNEL_VERSION >= 132097
  185. # define __ASSUME_AT_XID 1
  186. #endif
  187. /* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way
  188. and the vfork syscall made it into the official kernel. */
  189. #if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__
  190. # define __ASSUME_STD_AUXV 1
  191. # define __ASSUME_VFORK_SYSCALL 1
  192. #endif
  193. /* Starting with 2.4.5 kernels the mmap2 syscall made it into the official
  194. kernel. But PowerPC64 does not support a separate MMAP2 call. */
  195. #if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ \
  196. && !defined __powerpc64__
  197. # define __ASSUME_MMAP2_SYSCALL 1
  198. #endif
  199. /* Starting with 2.4.21 PowerPC implements the new prctl syscall.
  200. This allows applications to get/set the Floating Point Exception Mode. */
  201. #if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc__
  202. # define __ASSUME_NEW_PRCTL_SYSCALL 1
  203. #endif
  204. /* Starting with 2.4.21 the PowerPC32 clone syscall works as expected. */
  205. #if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc__ \
  206. && !defined __powerpc64__
  207. # define __ASSUME_FIXED_CLONE_SYSCALL 1
  208. #endif
  209. /* Starting with 2.4.21 PowerPC64 implements the new rt_sigreturn syscall.
  210. The new rt_sigreturn takes an ucontext pointer allowing rt_sigreturn
  211. to be used in the set/swapcontext implementation. */
  212. #if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc64__
  213. # define __ASSUME_NEW_RT_SIGRETURN_SYSCALL 1
  214. #endif
  215. /* On x86, the set_thread_area syscall was introduced in 2.5.29, but its
  216. semantics was changed in 2.5.30, and again after 2.5.31. */
  217. #if __LINUX_KERNEL_VERSION >= 132384 && defined __i386__
  218. # define __ASSUME_SET_THREAD_AREA_SYSCALL 1
  219. #endif
  220. /* The vfork syscall on x86 and arm was definitely available in 2.4. */
  221. #if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__)
  222. # define __ASSUME_VFORK_SYSCALL 1
  223. #endif
  224. /* There are an infinite number of PA-RISC kernel versions numbered
  225. 2.4.0. But they've not really been released as such. We require
  226. and expect the final version here. */
  227. #ifdef __hppa__
  228. # define __ASSUME_32BITUIDS 1
  229. # define __ASSUME_TRUNCATE64_SYSCALL 1
  230. # define __ASSUME_MMAP2_SYSCALL 1
  231. # define __ASSUME_STAT64_SYSCALL 1
  232. # define __ASSUME_IPC64 1
  233. # define __ASSUME_ST_INO_64_BIT 1
  234. # define __ASSUME_FCNTL64 1
  235. # define __ASSUME_GETDENTS64_SYSCALL 1
  236. #endif
  237. /* Alpha switched to a 64-bit timeval sometime before 2.2.0. */
  238. #if __LINUX_KERNEL_VERSION >= 131584 && defined __alpha__
  239. # define __ASSUME_TIMEVAL64 1
  240. #endif
  241. #if defined __mips__ && _MIPS_SIM == _ABIN32
  242. # define __ASSUME_FCNTL64 1
  243. #endif
  244. /* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize
  245. their availability with one define. The changes were made first
  246. for i386 and the have to be done separately for the other archs.
  247. For i386 we pick 2.5.50 as the first version with support. */
  248. #if __LINUX_KERNEL_VERSION >= 132402 && defined __i386__
  249. # define __ASSUME_CLONE_THREAD_FLAGS 1
  250. #endif
  251. /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
  252. x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */
  253. #if __LINUX_KERNEL_VERSION >= 0x020617 \
  254. && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
  255. || defined __ia64__ || defined __sparc__ || defined __s390__)
  256. # define __ASSUME_O_CLOEXEC 1
  257. #endif
  258. /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
  259. * x86-64, PPC, IA-64, and SPARC in 2.6.27. */
  260. #if (__LINUX_KERNEL_VERSION >= 0x02061b \
  261. && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
  262. || defined __ia64__ || defined __sparc__ || defined __s390__) \
  263. ) || (__LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__) \
  264. || defined __aarch64__ || defined __tile__
  265. /* # define __ASSUME_SOCK_CLOEXEC 1 */
  266. /* # define __ASSUME_IN_NONBLOCK 1 */
  267. # define __ASSUME_PIPE2 1
  268. /* # define __ASSUME_EVENTFD2 1 */
  269. /* # define __ASSUME_SIGNALFD4 1 */
  270. /* # define __ASSUME_DUP3 1 */
  271. #endif
  272. /* These features were surely available with 2.4.12. */
  273. #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
  274. # define __ASSUME_MMAP2_SYSCALL 1
  275. # define __ASSUME_TRUNCATE64_SYSCALL 1
  276. # define __ASSUME_STAT64_SYSCALL 1
  277. # define __ASSUME_FCNTL64 1
  278. # define __ASSUME_VFORK_SYSCALL 1
  279. #endif
  280. /* Beginning with 2.5.63 support for realtime and monotonic clocks and
  281. timers based on them is available. */
  282. #if __LINUX_KERNEL_VERSION >= 132415
  283. # define __ASSUME_POSIX_TIMERS 1
  284. #endif
  285. /* Beginning with 2.6.12 the clock and timer supports CPU clocks. */
  286. #if __LINUX_KERNEL_VERSION >= 0x2060c
  287. # define __ASSUME_POSIX_CPU_TIMERS 1
  288. #endif
  289. /* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize
  290. their availability with one define. The changes were made first
  291. for i386 and the have to be done separately for the other archs.
  292. For ia64, s390*, PPC, x86-64 we pick 2.5.64 as the first version
  293. with support. */
  294. #if __LINUX_KERNEL_VERSION >= 132416 \
  295. && (defined __ia64__ || defined __s390__ || defined __powerpc__ \
  296. || defined __x86_64__ || defined __sh__)
  297. # define __ASSUME_CLONE_THREAD_FLAGS 1
  298. #endif
  299. /* With kernel 2.4.17 we always have netlink support. */
  300. #if __LINUX_KERNEL_VERSION >= (132096+17)
  301. # define __ASSUME_NETLINK_SUPPORT 1
  302. #endif
  303. /* The requeue futex functionality was introduced in 2.5.70. */
  304. #if __LINUX_KERNEL_VERSION >= 132422
  305. # define __ASSUME_FUTEX_REQUEUE 1
  306. #endif
  307. /* The statfs64 syscalls are available in 2.5.74. */
  308. #if __LINUX_KERNEL_VERSION >= 132426
  309. # define __ASSUME_STATFS64 1
  310. #endif
  311. /* Starting with at least 2.5.74 the kernel passes the setuid-like exec
  312. flag unconditionally up to the child. */
  313. #if __LINUX_KERNEL_VERSION >= 132426
  314. # define __ASSUME_AT_SECURE 1
  315. #endif
  316. /* Starting with the 2.5.75 kernel the kernel fills in the correct value
  317. in the si_pid field passed as part of the siginfo_t struct to signal
  318. handlers. */
  319. #if __LINUX_KERNEL_VERSION >= 132427
  320. # define __ASSUME_CORRECT_SI_PID 1
  321. #endif
  322. /* The tgkill syscall was instroduced for i386 in 2.5.75. For Alpha
  323. it was introduced in 2.6.0-test1 which unfortunately cannot be
  324. distinguished from 2.6.0. On x86-64, ppc, and ppc64 it was
  325. introduced in 2.6.0-test3. */
  326. #if (__LINUX_KERNEL_VERSION >= 132427 && defined __i386__) \
  327. || (__LINUX_KERNEL_VERSION >= 132609 && defined __alpha__) \
  328. || (__LINUX_KERNEL_VERSION >= 132609 && defined __x86_64__) \
  329. || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
  330. || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
  331. # define __ASSUME_TGKILL 1
  332. #endif
  333. /* The utimes syscall has been available for some architectures
  334. forever. For x86 it was introduced after 2.5.75, for x86-64,
  335. ppc, and ppc64 it was introduced in 2.6.0-test3. */
  336. #if defined __alpha__ || defined __ia64__ || defined __hppa__ \
  337. || defined __sparc__ \
  338. || (__LINUX_KERNEL_VERSION > 132427 && defined __i386__) \
  339. || (__LINUX_KERNEL_VERSION > 132609 && defined __x86_64__) \
  340. || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
  341. || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
  342. # define __ASSUME_UTIMES 1
  343. #endif
  344. // XXX Disabled for now since the semantics we want is not achieved.
  345. #if 0
  346. /* The CLONE_STOPPED flag was introduced in the 2.6.0-test1 series. */
  347. #if __LINUX_KERNEL_VERSION >= 132609
  348. # define __ASSUME_CLONE_STOPPED 1
  349. #endif
  350. #endif
  351. /* The fixed version of the posix_fadvise64 syscall appeared in
  352. 2.6.0-test3. At least for x86. Powerpc support appeared in
  353. 2.6.2, but for 32-bit userspace only. */
  354. #if (__LINUX_KERNEL_VERSION >= 132609 && defined __i386__) \
  355. || (__LINUX_KERNEL_VERSION >= 132610 && defined __powerpc__ \
  356. && !defined __powerpc64__)
  357. # define __ASSUME_FADVISE64_64_SYSCALL 1
  358. #endif
  359. /* The PROT_GROWSDOWN/PROT_GROWSUP flags were introduced in the 2.6.0-test
  360. series. */
  361. #if __LINUX_KERNEL_VERSION >= 132609
  362. # define __ASSUME_PROT_GROWSUPDOWN 1
  363. #endif
  364. /* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector
  365. SIMD (AKA Altivec, VMX) instructions and register state. This changes
  366. the overall size of the sigcontext and adds the swapcontext syscall. */
  367. #if __LINUX_KERNEL_VERSION >= 132608 && defined __powerpc__
  368. # define __ASSUME_SWAPCONTEXT_SYSCALL 1
  369. #endif
  370. /* The CLONE_DETACHED flag is not necessary in 2.6.2 kernels, it is
  371. implied. */
  372. #if __LINUX_KERNEL_VERSION >= 132610
  373. # define __ASSUME_NO_CLONE_DETACHED 1
  374. #endif
  375. /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
  376. information as well and in between 2.6.5 and 2.6.8 most compat wrappers
  377. were fixed too. Except s390{,x} which was fixed in 2.6.11. */
  378. #if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
  379. || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
  380. # define __ASSUME_GETDENTS32_D_TYPE 1
  381. #endif
  382. /* Starting with version 2.5.3, the initial location returned by `brk'
  383. after exec is always rounded up to the next page. */
  384. #if __LINUX_KERNEL_VERSION >= 132355
  385. # define __ASSUME_BRK_PAGE_ROUNDED 1
  386. #endif
  387. /* Starting with version 2.6.9, the waitid system call is available.
  388. Except for powerpc and powerpc64, where it is available in 2.6.12. */
  389. #if (__LINUX_KERNEL_VERSION >= 0x020609 && !defined __powerpc__) \
  390. || (__LINUX_KERNEL_VERSION >= 0x02060c && defined __powerpc__)
  391. # define __ASSUME_WAITID_SYSCALL 1
  392. #endif
  393. /* Starting with version 2.6.9, SSI_IEEE_RAISE_EXCEPTION exists. */
  394. #if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
  395. #define __ASSUME_IEEE_RAISE_EXCEPTION 1
  396. #endif
  397. /* Support for the accept4 syscall was added in 2.6.28. */
  398. #if __LINUX_KERNEL_VERSION >= 0x02061c \
  399. && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
  400. || defined __sparc__ || defined __s390__)
  401. # define __ASSUME_ACCEPT4 1
  402. #endif
  403. /* Support for the accept4 syscall for alpha was added after 2.6.33-rc1. */
  404. #if __LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__
  405. # define __ASSUME_ACCEPT4 1
  406. #endif
  407. /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
  408. #if __LINUX_KERNEL_VERSION >= 0x02061d
  409. # define __ASSUME_FUTEX_CLOCK_REALTIME 1
  410. #endif
  411. /* Support for PI futexes was added in 2.6.18. */
  412. #if __LINUX_KERNEL_VERSION >= 0x020612
  413. # define __ASSUME_FUTEX_LOCK_PI 1
  414. #endif
  415. /* Support for private futexes was added in 2.6.22. */
  416. #if __LINUX_KERNEL_VERSION >= 0x020616
  417. # define __ASSUME_PRIVATE_FUTEX 1
  418. #endif
  419. /* Support for fallocate was added in 2.6.23,
  420. on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
  421. #if __LINUX_KERNEL_VERSION >= 0x020617 \
  422. && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
  423. && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
  424. # define __ASSUME_FALLOCATE 1
  425. #endif
  426. /* getcpu is a syscall for x86-64 since 3.1. */
  427. #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
  428. # define __ASSUME_GETCPU_SYSCALL 1
  429. #endif