kernel-features.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Set flags signalling availability of kernel features based on given
  2. kernel version number. SPARC version.
  3. Copyright (C) 1999-2019 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. #include_next <kernel-features.h>
  17. /* 32-bit SPARC kernels do not support
  18. futex_atomic_cmpxchg_inatomic. */
  19. #if !defined __arch64__ && !defined __sparc_v9__
  20. # undef __ASSUME_SET_ROBUST_LIST
  21. #endif
  22. /* These syscalls were added for 32-bit in 4.4 (but present for 64-bit
  23. in all supported kernel versions); the architecture-independent
  24. kernel-features.h assumes some of them to be present by default.
  25. getpeername and getsockname syscalls were also added for 32-bit in
  26. 4.4, but only for 32-bit kernels, not in the compat syscall table
  27. for 64-bit kernels. */
  28. #if !defined __arch64__ && __LINUX_KERNEL_VERSION < 0x040400
  29. # undef __ASSUME_SENDMSG_SYSCALL
  30. # undef __ASSUME_RECVMSG_SYSCALL
  31. # undef __ASSUME_ACCEPT_SYSCALL
  32. # undef __ASSUME_CONNECT_SYSCALL
  33. # undef __ASSUME_RECVFROM_SYSCALL
  34. # undef __ASSUME_SENDTO_SYSCALL
  35. #else
  36. # define __ASSUME_SOCKET_SYSCALL 1
  37. # define __ASSUME_SOCKETPAIR_SYSCALL 1
  38. # define __ASSUME_GETSOCKOPT_SYSCALL 1
  39. # define __ASSUME_SHUTDOWN_SYSCALL 1
  40. #endif
  41. /* These syscalls were added for both 32-bit and 64-bit in 4.4. */
  42. #if __LINUX_KERNEL_VERSION >= 0x040400
  43. # define __ASSUME_BIND_SYSCALL 1
  44. # define __ASSUME_LISTEN_SYSCALL 1
  45. # define __ASSUME_SETSOCKOPT_SYSCALL 1
  46. #endif
  47. #ifdef __arch64__
  48. /* sparc64 defines __NR_pause, however it is not supported (ENOSYS).
  49. Undefine so pause.c can use a correct alternative. */
  50. # undef __NR_pause
  51. #endif
  52. /* sparc only supports ipc syscall. */
  53. #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
  54. /* Support for the renameat2 syscall was added in 3.16. */
  55. #if __LINUX_KERNEL_VERSION < 0x031000
  56. # undef __ASSUME_RENAMEAT2
  57. #endif
  58. /* SPARC kernel Kconfig does not define CONFIG_CLONE_BACKWARDS, however it
  59. has the same ABI as if it did, implemented by sparc-specific code
  60. (sparc_do_fork).
  61. It also has a unique return value convention:
  62. Parent --> %o0 == child's pid, %o1 == 0
  63. Child --> %o0 == parent's pid, %o1 == 1
  64. Which required a special macro to correct issue the syscall
  65. (INLINE_CLONE_SYSCALL). */
  66. #undef __ASSUME_CLONE_DEFAULT
  67. #define __ASSUME_CLONE_BACKWARDS 1