kernel-features.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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. /* The utimes syscall has been available for some architectures
  317. forever. For x86 it was introduced after 2.5.75, for x86-64,
  318. ppc, and ppc64 it was introduced in 2.6.0-test3. */
  319. #if defined __alpha__ || defined __ia64__ || defined __hppa__ \
  320. || defined __sparc__ \
  321. || (__LINUX_KERNEL_VERSION > 132427 && defined __i386__) \
  322. || (__LINUX_KERNEL_VERSION > 132609 && defined __x86_64__) \
  323. || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
  324. || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
  325. # define __ASSUME_UTIMES 1
  326. #endif
  327. // XXX Disabled for now since the semantics we want is not achieved.
  328. #if 0
  329. /* The CLONE_STOPPED flag was introduced in the 2.6.0-test1 series. */
  330. #if __LINUX_KERNEL_VERSION >= 132609
  331. # define __ASSUME_CLONE_STOPPED 1
  332. #endif
  333. #endif
  334. /* The fixed version of the posix_fadvise64 syscall appeared in
  335. 2.6.0-test3. At least for x86. Powerpc support appeared in
  336. 2.6.2, but for 32-bit userspace only. */
  337. #if (__LINUX_KERNEL_VERSION >= 132609 && defined __i386__) \
  338. || (__LINUX_KERNEL_VERSION >= 132610 && defined __powerpc__ \
  339. && !defined __powerpc64__)
  340. # define __ASSUME_FADVISE64_64_SYSCALL 1
  341. #endif
  342. /* The PROT_GROWSDOWN/PROT_GROWSUP flags were introduced in the 2.6.0-test
  343. series. */
  344. #if __LINUX_KERNEL_VERSION >= 132609
  345. # define __ASSUME_PROT_GROWSUPDOWN 1
  346. #endif
  347. /* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector
  348. SIMD (AKA Altivec, VMX) instructions and register state. This changes
  349. the overall size of the sigcontext and adds the swapcontext syscall. */
  350. #if __LINUX_KERNEL_VERSION >= 132608 && defined __powerpc__
  351. # define __ASSUME_SWAPCONTEXT_SYSCALL 1
  352. #endif
  353. /* The CLONE_DETACHED flag is not necessary in 2.6.2 kernels, it is
  354. implied. */
  355. #if __LINUX_KERNEL_VERSION >= 132610
  356. # define __ASSUME_NO_CLONE_DETACHED 1
  357. #endif
  358. /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
  359. information as well and in between 2.6.5 and 2.6.8 most compat wrappers
  360. were fixed too. Except s390{,x} which was fixed in 2.6.11. */
  361. #if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
  362. || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
  363. # define __ASSUME_GETDENTS32_D_TYPE 1
  364. #endif
  365. /* Starting with version 2.5.3, the initial location returned by `brk'
  366. after exec is always rounded up to the next page. */
  367. #if __LINUX_KERNEL_VERSION >= 132355
  368. # define __ASSUME_BRK_PAGE_ROUNDED 1
  369. #endif
  370. /* Starting with version 2.6.9, the waitid system call is available.
  371. Except for powerpc and powerpc64, where it is available in 2.6.12. */
  372. #if (__LINUX_KERNEL_VERSION >= 0x020609 && !defined __powerpc__) \
  373. || (__LINUX_KERNEL_VERSION >= 0x02060c && defined __powerpc__)
  374. # define __ASSUME_WAITID_SYSCALL 1
  375. #endif
  376. /* Starting with version 2.6.9, SSI_IEEE_RAISE_EXCEPTION exists. */
  377. #if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
  378. #define __ASSUME_IEEE_RAISE_EXCEPTION 1
  379. #endif
  380. /* Support for the accept4 syscall was added in 2.6.28. */
  381. #if __LINUX_KERNEL_VERSION >= 0x02061c \
  382. && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
  383. || defined __sparc__ || defined __s390__)
  384. # define __ASSUME_ACCEPT4 1
  385. #endif
  386. /* Support for the accept4 syscall for alpha was added after 2.6.33-rc1. */
  387. #if __LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__
  388. # define __ASSUME_ACCEPT4 1
  389. #endif
  390. /* Support for the recvmmsg/sendmmsg syscall was added in 2.6.33 */
  391. #if __LINUX_KERNEL_VERSION >= 0x020621
  392. #define __ASSUME_RECVMMSG_SYSCALL 1
  393. #define __ASSUME_SENDMMSG_SYSCALL 1
  394. #endif
  395. /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
  396. #if __LINUX_KERNEL_VERSION >= 0x02061d
  397. # define __ASSUME_FUTEX_CLOCK_REALTIME 1
  398. #endif
  399. /* Support for PI futexes was added in 2.6.18. */
  400. #if __LINUX_KERNEL_VERSION >= 0x020612
  401. # define __ASSUME_FUTEX_LOCK_PI 1
  402. #endif
  403. /* Support for private futexes was added in 2.6.22. */
  404. #if __LINUX_KERNEL_VERSION >= 0x020616
  405. # define __ASSUME_PRIVATE_FUTEX 1
  406. #endif
  407. /* Support for fallocate was added in 2.6.23,
  408. on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
  409. #if __LINUX_KERNEL_VERSION >= 0x020617 \
  410. && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
  411. && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
  412. # define __ASSUME_FALLOCATE 1
  413. #endif
  414. /* prlimit64 is available in 2.6.36. */
  415. #if __LINUX_KERNEL_VERSION >= 0x020624
  416. # define __ASSUME_PRLIMIT64 1
  417. #endif
  418. /* getcpu is a syscall for x86-64 since 3.1. */
  419. #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
  420. # define __ASSUME_GETCPU_SYSCALL 1
  421. #endif
  422. /* getrandom syscall (widely) appeared around 4.0.0 */
  423. #if __LINUX_KERNEL_VERSION >= 0x040000
  424. # define __ASSUME_GETRANDOM_SYSCALL 1
  425. #endif