kernel-features.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. /* This file must not contain any C code. At least it must be protected
  18. to allow using the file also in assembler files. */
  19. #if defined __mips__
  20. # include <sgidefs.h>
  21. #endif
  22. #include <linux/version.h>
  23. #define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE
  24. /* When was `poll' introduced? */
  25. #if __LINUX_KERNEL_VERSION >= 131584
  26. # define __ASSUME_POLL_SYSCALL 1
  27. #endif
  28. /* Real-time signal became usable in 2.1.70. */
  29. #if __LINUX_KERNEL_VERSION >= 131398
  30. # define __ASSUME_REALTIME_SIGNALS 1
  31. #endif
  32. /* Beginning with 2.5.63 support for realtime and monotonic clocks and
  33. timers based on them is available. */
  34. #if __LINUX_KERNEL_VERSION >= 132415
  35. # define __ASSUME_POSIX_TIMERS 1
  36. #endif
  37. /* On x86, the set_thread_area syscall was introduced in 2.5.29, but its
  38. semantics was changed in 2.5.30, and again after 2.5.31. */
  39. #if __LINUX_KERNEL_VERSION >= 132384 && defined __i386__
  40. # define __ASSUME_SET_THREAD_AREA_SYSCALL 1
  41. #endif
  42. /* We can use the LDTs for threading with Linux 2.3.99 and newer. */
  43. #if __LINUX_KERNEL_VERSION >= 131939
  44. # define __ASSUME_LDT_WORKS 1
  45. #endif
  46. /* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way
  47. and the vfork syscall made it into the official kernel. */
  48. #if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__
  49. # define __ASSUME_STD_AUXV 1
  50. # define __ASSUME_VFORK_SYSCALL 1
  51. #endif
  52. /* The vfork syscall on x86 and arm was definitely available in 2.4. */
  53. #if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__)
  54. # define __ASSUME_VFORK_SYSCALL 1
  55. #endif
  56. /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
  57. * information as well and in between 2.6.5 and 2.6.8 most compat wrappers
  58. * were fixed too. Except s390{,x} which was fixed in 2.6.11. */
  59. #if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
  60. || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
  61. # define __ASSUME_GETDENTS32_D_TYPE 1
  62. #endif
  63. /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
  64. x86-64, PPC, IA-64, SPARC< and S390 in 2.6.23. */
  65. #if __LINUX_KERNEL_VERSION >= 0x020617 \
  66. && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
  67. || defined __ia64__ || defined __sparc__ || defined __s390__)
  68. # define __ASSUME_O_CLOEXEC 1
  69. #endif
  70. /* These features were surely available with 2.4.12. */
  71. #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
  72. # define __ASSUME_MMAP2_SYSCALL 1
  73. # define __ASSUME_TRUNCATE64_SYSCALL 1
  74. # define __ASSUME_STAT64_SYSCALL 1
  75. # define __ASSUME_FCNTL64 1
  76. # define __ASSUME_VFORK_SYSCALL 1
  77. #endif
  78. /* This header was added somewhere around 2.6.13 */
  79. #if __LINUX_KERNEL_VERSION >= 132621
  80. # define HAVE_LINUX_CPUMASK_H 1
  81. #endif