Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 1 | #!/bin/sh |
Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0 |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 3 | # |
| 4 | # Check if current architecture are missing any function calls compared |
| 5 | # to i386. |
| 6 | # i386 define a number of legacy system calls that are i386 specific |
| 7 | # and listed below so they are ignored. |
| 8 | # |
| 9 | # Usage: |
Geert Uytterhoeven | 6e5f685 | 2010-08-25 12:22:40 +0200 | [diff] [blame] | 10 | # checksyscalls.sh gcc gcc-options |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 11 | # |
| 12 | |
| 13 | ignore_list() { |
| 14 | cat << EOF |
| 15 | #include <asm/types.h> |
| 16 | #include <asm/unistd.h> |
| 17 | |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 18 | /* *at */ |
| 19 | #define __IGNORE_open /* openat */ |
| 20 | #define __IGNORE_link /* linkat */ |
| 21 | #define __IGNORE_unlink /* unlinkat */ |
| 22 | #define __IGNORE_mknod /* mknodat */ |
| 23 | #define __IGNORE_chmod /* fchmodat */ |
| 24 | #define __IGNORE_chown /* fchownat */ |
| 25 | #define __IGNORE_mkdir /* mkdirat */ |
| 26 | #define __IGNORE_rmdir /* unlinkat */ |
| 27 | #define __IGNORE_lchown /* fchownat */ |
| 28 | #define __IGNORE_access /* faccessat */ |
James Hogan | 68b7752 | 2014-04-23 11:08:06 +0100 | [diff] [blame] | 29 | #define __IGNORE_rename /* renameat2 */ |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 30 | #define __IGNORE_readlink /* readlinkat */ |
| 31 | #define __IGNORE_symlink /* symlinkat */ |
| 32 | #define __IGNORE_utimes /* futimesat */ |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 33 | #define __IGNORE_stat /* fstatat */ |
| 34 | #define __IGNORE_lstat /* fstatat */ |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 35 | #define __IGNORE_stat64 /* fstatat64 */ |
| 36 | #define __IGNORE_lstat64 /* fstatat64 */ |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 37 | |
Yury Norov | 80d7da1 | 2018-05-16 11:18:50 +0300 | [diff] [blame] | 38 | #ifndef __ARCH_WANT_SET_GET_RLIMIT |
| 39 | #define __IGNORE_getrlimit /* getrlimit */ |
| 40 | #define __IGNORE_setrlimit /* setrlimit */ |
| 41 | #endif |
| 42 | |
Mike Rapoport | 7bb7f2a | 2021-07-07 18:08:11 -0700 | [diff] [blame] | 43 | #ifndef __ARCH_WANT_MEMFD_SECRET |
| 44 | #define __IGNORE_memfd_secret |
| 45 | #endif |
| 46 | |
James Hogan | 68b7752 | 2014-04-23 11:08:06 +0100 | [diff] [blame] | 47 | /* Missing flags argument */ |
| 48 | #define __IGNORE_renameat /* renameat2 */ |
| 49 | |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 50 | /* CLOEXEC flag */ |
| 51 | #define __IGNORE_pipe /* pipe2 */ |
| 52 | #define __IGNORE_dup2 /* dup3 */ |
| 53 | #define __IGNORE_epoll_create /* epoll_create1 */ |
| 54 | #define __IGNORE_inotify_init /* inotify_init1 */ |
| 55 | #define __IGNORE_eventfd /* eventfd2 */ |
| 56 | #define __IGNORE_signalfd /* signalfd4 */ |
| 57 | |
| 58 | /* MMU */ |
| 59 | #ifndef CONFIG_MMU |
| 60 | #define __IGNORE_madvise |
| 61 | #define __IGNORE_mbind |
| 62 | #define __IGNORE_mincore |
| 63 | #define __IGNORE_mlock |
| 64 | #define __IGNORE_mlockall |
| 65 | #define __IGNORE_munlock |
| 66 | #define __IGNORE_munlockall |
| 67 | #define __IGNORE_mprotect |
| 68 | #define __IGNORE_msync |
| 69 | #define __IGNORE_migrate_pages |
| 70 | #define __IGNORE_move_pages |
| 71 | #define __IGNORE_remap_file_pages |
| 72 | #define __IGNORE_get_mempolicy |
| 73 | #define __IGNORE_set_mempolicy |
| 74 | #define __IGNORE_swapoff |
| 75 | #define __IGNORE_swapon |
| 76 | #endif |
| 77 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 78 | /* System calls for 32-bit kernels only */ |
| 79 | #if BITS_PER_LONG == 64 |
| 80 | #define __IGNORE_sendfile64 |
| 81 | #define __IGNORE_ftruncate64 |
| 82 | #define __IGNORE_truncate64 |
| 83 | #define __IGNORE_stat64 |
| 84 | #define __IGNORE_lstat64 |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 85 | #define __IGNORE_fcntl64 |
| 86 | #define __IGNORE_fadvise64_64 |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 87 | #define __IGNORE_fstatfs64 |
| 88 | #define __IGNORE_statfs64 |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 89 | #define __IGNORE_llseek |
| 90 | #define __IGNORE_mmap2 |
Arnd Bergmann | 48166e6 | 2019-01-10 12:45:11 +0100 | [diff] [blame] | 91 | #define __IGNORE_clock_gettime64 |
| 92 | #define __IGNORE_clock_settime64 |
| 93 | #define __IGNORE_clock_adjtime64 |
| 94 | #define __IGNORE_clock_getres_time64 |
| 95 | #define __IGNORE_clock_nanosleep_time64 |
| 96 | #define __IGNORE_timer_gettime64 |
| 97 | #define __IGNORE_timer_settime64 |
| 98 | #define __IGNORE_timerfd_gettime64 |
| 99 | #define __IGNORE_timerfd_settime64 |
| 100 | #define __IGNORE_utimensat_time64 |
| 101 | #define __IGNORE_pselect6_time64 |
| 102 | #define __IGNORE_ppoll_time64 |
| 103 | #define __IGNORE_io_pgetevents_time64 |
| 104 | #define __IGNORE_recvmmsg_time64 |
| 105 | #define __IGNORE_mq_timedsend_time64 |
| 106 | #define __IGNORE_mq_timedreceive_time64 |
| 107 | #define __IGNORE_semtimedop_time64 |
| 108 | #define __IGNORE_rt_sigtimedwait_time64 |
| 109 | #define __IGNORE_futex_time64 |
| 110 | #define __IGNORE_sched_rr_get_interval_time64 |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 111 | #else |
| 112 | #define __IGNORE_sendfile |
| 113 | #define __IGNORE_ftruncate |
| 114 | #define __IGNORE_truncate |
| 115 | #define __IGNORE_stat |
| 116 | #define __IGNORE_lstat |
| 117 | #define __IGNORE_fstat |
| 118 | #define __IGNORE_fcntl |
| 119 | #define __IGNORE_fadvise64 |
| 120 | #define __IGNORE_newfstatat |
| 121 | #define __IGNORE_fstatfs |
| 122 | #define __IGNORE_statfs |
| 123 | #define __IGNORE_lseek |
| 124 | #define __IGNORE_mmap |
Arnd Bergmann | 48166e6 | 2019-01-10 12:45:11 +0100 | [diff] [blame] | 125 | #define __IGNORE_clock_gettime |
| 126 | #define __IGNORE_clock_settime |
| 127 | #define __IGNORE_clock_adjtime |
| 128 | #define __IGNORE_clock_getres |
| 129 | #define __IGNORE_clock_nanosleep |
| 130 | #define __IGNORE_timer_gettime |
| 131 | #define __IGNORE_timer_settime |
| 132 | #define __IGNORE_timerfd_gettime |
| 133 | #define __IGNORE_timerfd_settime |
| 134 | #define __IGNORE_utimensat |
| 135 | #define __IGNORE_pselect6 |
| 136 | #define __IGNORE_ppoll |
| 137 | #define __IGNORE_io_pgetevents |
| 138 | #define __IGNORE_recvmmsg |
| 139 | #define __IGNORE_mq_timedsend |
Arnd Bergmann | 1d5b823 | 2019-02-18 21:14:32 +0100 | [diff] [blame] | 140 | #define __IGNORE_mq_timedreceive |
Arnd Bergmann | 48166e6 | 2019-01-10 12:45:11 +0100 | [diff] [blame] | 141 | #define __IGNORE_semtimedop |
| 142 | #define __IGNORE_rt_sigtimedwait |
| 143 | #define __IGNORE_futex |
| 144 | #define __IGNORE_sched_rr_get_interval |
Arnd Bergmann | c8ce48f | 2019-02-18 17:30:06 +0100 | [diff] [blame] | 145 | #define __IGNORE_gettimeofday |
| 146 | #define __IGNORE_settimeofday |
| 147 | #define __IGNORE_wait4 |
| 148 | #define __IGNORE_adjtimex |
| 149 | #define __IGNORE_nanosleep |
| 150 | #define __IGNORE_io_getevents |
| 151 | #define __IGNORE_recvmmsg |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 152 | #endif |
| 153 | |
| 154 | /* i386-specific or historical system calls */ |
| 155 | #define __IGNORE_break |
| 156 | #define __IGNORE_stty |
| 157 | #define __IGNORE_gtty |
| 158 | #define __IGNORE_ftime |
| 159 | #define __IGNORE_prof |
| 160 | #define __IGNORE_lock |
| 161 | #define __IGNORE_mpx |
| 162 | #define __IGNORE_ulimit |
| 163 | #define __IGNORE_profil |
| 164 | #define __IGNORE_ioperm |
| 165 | #define __IGNORE_iopl |
| 166 | #define __IGNORE_idle |
| 167 | #define __IGNORE_modify_ldt |
| 168 | #define __IGNORE_ugetrlimit |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 169 | #define __IGNORE_vm86 |
| 170 | #define __IGNORE_vm86old |
| 171 | #define __IGNORE_set_thread_area |
| 172 | #define __IGNORE_get_thread_area |
| 173 | #define __IGNORE_madvise1 |
| 174 | #define __IGNORE_oldstat |
| 175 | #define __IGNORE_oldfstat |
| 176 | #define __IGNORE_oldlstat |
| 177 | #define __IGNORE_oldolduname |
| 178 | #define __IGNORE_olduname |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 179 | #define __IGNORE_umount |
| 180 | #define __IGNORE_waitpid |
| 181 | #define __IGNORE_stime |
| 182 | #define __IGNORE_nice |
| 183 | #define __IGNORE_signal |
| 184 | #define __IGNORE_sigaction |
| 185 | #define __IGNORE_sgetmask |
| 186 | #define __IGNORE_sigsuspend |
| 187 | #define __IGNORE_sigpending |
| 188 | #define __IGNORE_ssetmask |
| 189 | #define __IGNORE_readdir |
| 190 | #define __IGNORE_socketcall |
| 191 | #define __IGNORE_ipc |
| 192 | #define __IGNORE_sigreturn |
| 193 | #define __IGNORE_sigprocmask |
| 194 | #define __IGNORE_bdflush |
| 195 | #define __IGNORE__llseek |
| 196 | #define __IGNORE__newselect |
| 197 | #define __IGNORE_create_module |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 198 | #define __IGNORE_query_module |
| 199 | #define __IGNORE_get_kernel_syms |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 200 | #define __IGNORE_sysfs |
| 201 | #define __IGNORE_uselib |
| 202 | #define __IGNORE__sysctl |
Arnd Bergmann | f3e4559 | 2017-03-23 16:18:51 +0100 | [diff] [blame] | 203 | #define __IGNORE_arch_prctl |
Firoz Khan | 930e129 | 2018-10-08 09:36:47 +0530 | [diff] [blame] | 204 | #define __IGNORE_nfsservctl |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 205 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 206 | /* ... including the "new" 32-bit uid syscalls */ |
| 207 | #define __IGNORE_lchown32 |
| 208 | #define __IGNORE_getuid32 |
| 209 | #define __IGNORE_getgid32 |
| 210 | #define __IGNORE_geteuid32 |
| 211 | #define __IGNORE_getegid32 |
| 212 | #define __IGNORE_setreuid32 |
| 213 | #define __IGNORE_setregid32 |
| 214 | #define __IGNORE_getgroups32 |
| 215 | #define __IGNORE_setgroups32 |
| 216 | #define __IGNORE_fchown32 |
| 217 | #define __IGNORE_setresuid32 |
| 218 | #define __IGNORE_getresuid32 |
| 219 | #define __IGNORE_setresgid32 |
| 220 | #define __IGNORE_getresgid32 |
| 221 | #define __IGNORE_chown32 |
| 222 | #define __IGNORE_setuid32 |
| 223 | #define __IGNORE_setgid32 |
| 224 | #define __IGNORE_setfsuid32 |
| 225 | #define __IGNORE_setfsgid32 |
| 226 | |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 227 | /* these can be expressed using other calls */ |
| 228 | #define __IGNORE_alarm /* setitimer */ |
| 229 | #define __IGNORE_creat /* open */ |
| 230 | #define __IGNORE_fork /* clone */ |
| 231 | #define __IGNORE_futimesat /* utimensat */ |
| 232 | #define __IGNORE_getpgrp /* getpgid */ |
| 233 | #define __IGNORE_getdents /* getdents64 */ |
| 234 | #define __IGNORE_pause /* sigsuspend */ |
| 235 | #define __IGNORE_poll /* ppoll */ |
| 236 | #define __IGNORE_select /* pselect6 */ |
| 237 | #define __IGNORE_epoll_wait /* epoll_pwait */ |
| 238 | #define __IGNORE_time /* gettimeofday */ |
| 239 | #define __IGNORE_uname /* newuname */ |
| 240 | #define __IGNORE_ustat /* statfs */ |
| 241 | #define __IGNORE_utime /* utimes */ |
| 242 | #define __IGNORE_vfork /* clone */ |
Arnd Bergmann | e64a1617 | 2009-05-13 22:56:28 +0000 | [diff] [blame] | 243 | |
David Woodhouse | edd5cd4 | 2007-06-27 14:10:09 -0700 | [diff] [blame] | 244 | /* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */ |
| 245 | #ifdef __NR_sync_file_range2 |
| 246 | #define __IGNORE_sync_file_range |
| 247 | #endif |
| 248 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 249 | /* Unmerged syscalls for AFS, STREAMS, etc. */ |
| 250 | #define __IGNORE_afs_syscall |
| 251 | #define __IGNORE_getpmsg |
| 252 | #define __IGNORE_putpmsg |
| 253 | #define __IGNORE_vserver |
Palmer Dabbelt | 3ef6ca4 | 2021-10-02 16:57:13 -0700 | [diff] [blame] | 254 | |
| 255 | /* 64-bit ports never needed these, and new 32-bit ports can use statx */ |
| 256 | #define __IGNORE_fstat64 |
| 257 | #define __IGNORE_fstatat64 |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 258 | EOF |
| 259 | } |
| 260 | |
| 261 | syscall_list() { |
Arnd Bergmann | d21832e | 2017-06-01 16:57:07 +0200 | [diff] [blame] | 262 | grep '^[0-9]' "$1" | sort -n | |
H. Peter Anvin | 29dc54c | 2011-11-11 15:57:53 -0800 | [diff] [blame] | 263 | while read nr abi name entry ; do |
Arnd Bergmann | d21832e | 2017-06-01 16:57:07 +0200 | [diff] [blame] | 264 | echo "#if !defined(__NR_${name}) && !defined(__IGNORE_${name})" |
| 265 | echo "#warning syscall ${name} not implemented" |
| 266 | echo "#endif" |
H. Peter Anvin | 29dc54c | 2011-11-11 15:57:53 -0800 | [diff] [blame] | 267 | done |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 268 | } |
| 269 | |
Ingo Molnar | 1f57d5d | 2015-06-03 18:36:41 +0200 | [diff] [blame] | 270 | (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \ |
Stephen Rothwell | 20fbb11 | 2021-09-06 15:47:02 +1000 | [diff] [blame] | 271 | $* -Wno-error -E -x c - > /dev/null |