]>
Commit | Line | Data |
---|---|---|
1 | /* Set flags signalling availability of kernel features based on given | |
2 | kernel version number. SPARC version. | |
3 | Copyright (C) 1999-2025 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 | #endif | |
44 | ||
45 | /* There syscalls were added for 32-bit in compat syscall table only | |
46 | in 4.20 (but present for 64-bit in all supported kernel versions). */ | |
47 | #if !defined __arch64__ && __LINUX_KERNEL_VERSION < 0x041400 | |
48 | # undef __ASSUME_GETSOCKNAME_SYSCALL | |
49 | # undef __ASSUME_GETPEERNAME_SYSCALL | |
50 | #endif | |
51 | ||
52 | /* These syscalls were added for both 32-bit and 64-bit in 4.4. */ | |
53 | #if __LINUX_KERNEL_VERSION < 0x040400 | |
54 | # undef __ASSUME_BIND_SYSCALL | |
55 | # undef __ASSUME_LISTEN_SYSCALL | |
56 | #endif | |
57 | ||
58 | #ifdef __arch64__ | |
59 | /* sparc64 defines __NR_pause, however it is not supported (ENOSYS). | |
60 | Undefine so pause.c can use a correct alternative. */ | |
61 | # undef __NR_pause | |
62 | #endif | |
63 | ||
64 | /* sparc only supports ipc syscall before 5.1. */ | |
65 | #if __LINUX_KERNEL_VERSION < 0x050100 | |
66 | # undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS | |
67 | # if !defined __arch64__ | |
68 | # undef __ASSUME_SYSVIPC_DEFAULT_IPC_64 | |
69 | # endif | |
70 | #endif | |
71 | ||
72 | /* Support for the renameat2 syscall was added in 3.16. */ | |
73 | #if __LINUX_KERNEL_VERSION < 0x031000 | |
74 | # undef __ASSUME_RENAMEAT2 | |
75 | #endif | |
76 | ||
77 | /* SPARC kernel Kconfig does not define CONFIG_CLONE_BACKWARDS, however it | |
78 | has the same ABI as if it did, implemented by sparc-specific code | |
79 | (sparc_do_fork). | |
80 | ||
81 | It also has a unique return value convention: | |
82 | ||
83 | Parent --> %o0 == child's pid, %o1 == 0 | |
84 | Child --> %o0 == parent's pid, %o1 == 1 | |
85 | ||
86 | Which required a special macro to correct issue the syscall | |
87 | (INLINE_CLONE_SYSCALL). */ | |
88 | #undef __ASSUME_CLONE_DEFAULT | |
89 | #define __ASSUME_CLONE_BACKWARDS 1 | |
90 | ||
91 | /* sparc does not provide clone3. */ | |
92 | #undef __ASSUME_CLONE3 | |
93 | #define __ASSUME_CLONE3 0 |