|
| 1 | +/* |
| 2 | + * Copyright 2021 Collabora Ltd. |
| 3 | + * SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 | + * |
| 5 | + * This program 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 | + * |
| 10 | + * This library is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | + * Lesser General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Lesser General Public |
| 16 | + * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 | + */ |
| 18 | + |
| 19 | +#pragma once |
| 20 | + |
| 21 | +#include <sys/syscall.h> |
| 22 | + |
| 23 | +#if defined(_MIPS_SIM) |
| 24 | +# if _MIPS_SIM == _MIPS_SIM_ABI32 |
| 25 | +# define FLATPAK_MISSING_SYSCALL_BASE 4000 |
| 26 | +# elif _MIPS_SIM == _MIPS_SIM_ABI64 |
| 27 | +# define FLATPAK_MISSING_SYSCALL_BASE 5000 |
| 28 | +# elif _MIPS_SIM == _MIPS_SIM_NABI32 |
| 29 | +# define FLATPAK_MISSING_SYSCALL_BASE 6000 |
| 30 | +# else |
| 31 | +# error "Unknown MIPS ABI" |
| 32 | +# endif |
| 33 | +#endif |
| 34 | + |
| 35 | +#if defined(__ia64__) |
| 36 | +# define FLATPAK_MISSING_SYSCALL_BASE 1024 |
| 37 | +#endif |
| 38 | + |
| 39 | +#if defined(__alpha__) |
| 40 | +# define FLATPAK_MISSING_SYSCALL_BASE 110 |
| 41 | +#endif |
| 42 | + |
| 43 | +#if defined(__x86_64__) && defined(__ILP32__) |
| 44 | +# define FLATPAK_MISSING_SYSCALL_BASE 0x40000000 |
| 45 | +#endif |
| 46 | + |
| 47 | +/* |
| 48 | + * FLATPAK_MISSING_SYSCALL_BASE: |
| 49 | + * |
| 50 | + * Number to add to the syscall numbers of recently-added syscalls |
| 51 | + * to get the appropriate syscall for the current ABI. |
| 52 | + */ |
| 53 | +#ifndef FLATPAK_MISSING_SYSCALL_BASE |
| 54 | +# define FLATPAK_MISSING_SYSCALL_BASE 0 |
| 55 | +#endif |
| 56 | + |
| 57 | +#ifndef __NR_open_tree |
| 58 | +# define __NR_open_tree (FLATPAK_MISSING_SYSCALL_BASE + 428) |
| 59 | +#endif |
| 60 | +#ifndef __SNR_open_tree |
| 61 | +# define __SNR_open_tree __NR_open_tree |
| 62 | +#endif |
| 63 | + |
| 64 | +#ifndef __NR_move_mount |
| 65 | +# define __NR_move_mount (FLATPAK_MISSING_SYSCALL_BASE + 429) |
| 66 | +#endif |
| 67 | +#ifndef __SNR_move_mount |
| 68 | +# define __SNR_move_mount __NR_move_mount |
| 69 | +#endif |
| 70 | + |
| 71 | +#ifndef __NR_fsopen |
| 72 | +# define __NR_fsopen (FLATPAK_MISSING_SYSCALL_BASE + 430) |
| 73 | +#endif |
| 74 | +#ifndef __SNR_fsopen |
| 75 | +# define __SNR_fsopen __NR_fsopen |
| 76 | +#endif |
| 77 | + |
| 78 | +#ifndef __NR_fsconfig |
| 79 | +# define __NR_fsconfig (FLATPAK_MISSING_SYSCALL_BASE + 431) |
| 80 | +#endif |
| 81 | +#ifndef __SNR_fsconfig |
| 82 | +# define __SNR_fsconfig __NR_fsconfig |
| 83 | +#endif |
| 84 | + |
| 85 | +#ifndef __NR_fsmount |
| 86 | +# define __NR_fsmount (FLATPAK_MISSING_SYSCALL_BASE + 432) |
| 87 | +#endif |
| 88 | +#ifndef __SNR_fsmount |
| 89 | +# define __SNR_fsmount __NR_fsmount |
| 90 | +#endif |
| 91 | + |
| 92 | +#ifndef __NR_fspick |
| 93 | +# define __NR_fspick (FLATPAK_MISSING_SYSCALL_BASE + 433) |
| 94 | +#endif |
| 95 | +#ifndef __SNR_fspick |
| 96 | +# define __SNR_fspick __NR_fspick |
| 97 | +#endif |
| 98 | + |
| 99 | +#ifndef __NR_pidfd_open |
| 100 | +# define __NR_pidfd_open (FLATPAK_MISSING_SYSCALL_BASE + 434) |
| 101 | +#endif |
| 102 | +#ifndef __SNR_pidfd_open |
| 103 | +# define __SNR_pidfd_open __NR_pidfd_open |
| 104 | +#endif |
| 105 | + |
| 106 | +#ifndef __NR_clone3 |
| 107 | +# define __NR_clone3 (FLATPAK_MISSING_SYSCALL_BASE + 435) |
| 108 | +#endif |
| 109 | +#ifndef __SNR_clone3 |
| 110 | +# define __SNR_clone3 __NR_clone3 |
| 111 | +#endif |
| 112 | + |
| 113 | +#ifndef __NR_close_range |
| 114 | +# define __NR_close_range (FLATPAK_MISSING_SYSCALL_BASE + 436) |
| 115 | +#endif |
| 116 | +#ifndef __SNR_close_range |
| 117 | +# define __SNR_close_range __NR_close_range |
| 118 | +#endif |
| 119 | + |
| 120 | +#ifndef __NR_openat2 |
| 121 | +# define __NR_openat2 (FLATPAK_MISSING_SYSCALL_BASE + 437) |
| 122 | +#endif |
| 123 | +#ifndef __SNR_openat2 |
| 124 | +# define __SNR_openat2 __NR_openat2 |
| 125 | +#endif |
| 126 | + |
| 127 | +#ifndef __NR_pidfd_getfd |
| 128 | +# define __NR_pidfd_getfd (FLATPAK_MISSING_SYSCALL_BASE + 438) |
| 129 | +#endif |
| 130 | +#ifndef __SNR_pidfd_getfd |
| 131 | +# define __SNR_pidfd_getfd __NR_pidfd_getfd |
| 132 | +#endif |
| 133 | + |
| 134 | +#ifndef __NR_faccessat2 |
| 135 | +# define __NR_faccessat2 (FLATPAK_MISSING_SYSCALL_BASE + 439) |
| 136 | +#endif |
| 137 | +#ifndef __SNR_faccessat2 |
| 138 | +# define __SNR_faccessat2 __NR_faccessat2 |
| 139 | +#endif |
| 140 | + |
| 141 | +#ifndef __NR_process_madvise |
| 142 | +# define __NR_process_madvise (FLATPAK_MISSING_SYSCALL_BASE + 440) |
| 143 | +#endif |
| 144 | +#ifndef __SNR_process_madvise |
| 145 | +# define __SNR_process_madvise __NR_process_madvise |
| 146 | +#endif |
| 147 | + |
| 148 | +#ifndef __NR_epoll_pwait2 |
| 149 | +# define __NR_epoll_pwait2 (FLATPAK_MISSING_SYSCALL_BASE + 441) |
| 150 | +#endif |
| 151 | +#ifndef __SNR_epoll_pwait2 |
| 152 | +# define __SNR_epoll_pwait2 __NR_epoll_pwait2 |
| 153 | +#endif |
| 154 | + |
| 155 | +#ifndef __NR_mount_setattr |
| 156 | +# define __NR_mount_setattr (FLATPAK_MISSING_SYSCALL_BASE + 442) |
| 157 | +#endif |
| 158 | +#ifndef __SNR_mount_setattr |
| 159 | +# define __SNR_mount_setattr __NR_mount_setattr |
| 160 | +#endif |
| 161 | + |
| 162 | +#ifndef __NR_quotactl_fd |
| 163 | +# define __NR_quotactl_fd (FLATPAK_MISSING_SYSCALL_BASE + 443) |
| 164 | +#endif |
| 165 | +#ifndef __SNR_quotactl_fd |
| 166 | +# define __SNR_quotactl_fd __NR_quotactl_fd |
| 167 | +#endif |
| 168 | + |
| 169 | +#ifndef __NR_landlock_create_ruleset |
| 170 | +# define __NR_landlock_create_ruleset (FLATPAK_MISSING_SYSCALL_BASE + 444) |
| 171 | +#endif |
| 172 | +#ifndef __SNR_landlock_create_ruleset |
| 173 | +# define __SNR_landlock_create_ruleset __NR_landlock_create_ruleset |
| 174 | +#endif |
| 175 | + |
| 176 | +#ifndef __NR_landlock_add_rule |
| 177 | +# define __NR_landlock_add_rule (FLATPAK_MISSING_SYSCALL_BASE + 445) |
| 178 | +#endif |
| 179 | +#ifndef __SNR_landlock_add_rule |
| 180 | +# define __SNR_landlock_add_rule __NR_landlock_add_rule |
| 181 | +#endif |
| 182 | + |
| 183 | +#ifndef __NR_landlock_restrict_self |
| 184 | +# define __NR_landlock_restrict_self (FLATPAK_MISSING_SYSCALL_BASE + 446) |
| 185 | +#endif |
| 186 | +#ifndef __SNR_landlock_restrict_self |
| 187 | +# define __SNR_landlock_restrict_self __NR_landlock_restrict_self |
| 188 | +#endif |
| 189 | + |
| 190 | +#ifndef __NR_memfd_secret |
| 191 | +# define __NR_memfd_secret (FLATPAK_MISSING_SYSCALL_BASE + 447) |
| 192 | +#endif |
| 193 | +#ifndef __SNR_memfd_secret |
| 194 | +# define __SNR_memfd_secret __NR_memfd_secret |
| 195 | +#endif |
| 196 | + |
| 197 | +/* Last updated: Linux 5.14, syscall numbers < 448 */ |
0 commit comments