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