WIP FPC-III support
[linux/fpc-iii.git] / scripts / checksyscalls.sh
bloba18b47695f55f1521569884c56ba6864558a1e4c
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
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.
9 # Usage:
10 # checksyscalls.sh gcc gcc-options
13 ignore_list() {
14 cat << EOF
15 #include <asm/types.h>
16 #include <asm/unistd.h>
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 */
29 #define __IGNORE_rename /* renameat2 */
30 #define __IGNORE_readlink /* readlinkat */
31 #define __IGNORE_symlink /* symlinkat */
32 #define __IGNORE_utimes /* futimesat */
33 #define __IGNORE_stat /* fstatat */
34 #define __IGNORE_lstat /* fstatat */
35 #define __IGNORE_stat64 /* fstatat64 */
36 #define __IGNORE_lstat64 /* fstatat64 */
38 #ifndef __ARCH_WANT_SET_GET_RLIMIT
39 #define __IGNORE_getrlimit /* getrlimit */
40 #define __IGNORE_setrlimit /* setrlimit */
41 #endif
43 /* Missing flags argument */
44 #define __IGNORE_renameat /* renameat2 */
46 /* CLOEXEC flag */
47 #define __IGNORE_pipe /* pipe2 */
48 #define __IGNORE_dup2 /* dup3 */
49 #define __IGNORE_epoll_create /* epoll_create1 */
50 #define __IGNORE_inotify_init /* inotify_init1 */
51 #define __IGNORE_eventfd /* eventfd2 */
52 #define __IGNORE_signalfd /* signalfd4 */
54 /* MMU */
55 #ifndef CONFIG_MMU
56 #define __IGNORE_madvise
57 #define __IGNORE_mbind
58 #define __IGNORE_mincore
59 #define __IGNORE_mlock
60 #define __IGNORE_mlockall
61 #define __IGNORE_munlock
62 #define __IGNORE_munlockall
63 #define __IGNORE_mprotect
64 #define __IGNORE_msync
65 #define __IGNORE_migrate_pages
66 #define __IGNORE_move_pages
67 #define __IGNORE_remap_file_pages
68 #define __IGNORE_get_mempolicy
69 #define __IGNORE_set_mempolicy
70 #define __IGNORE_swapoff
71 #define __IGNORE_swapon
72 #endif
74 /* System calls for 32-bit kernels only */
75 #if BITS_PER_LONG == 64
76 #define __IGNORE_sendfile64
77 #define __IGNORE_ftruncate64
78 #define __IGNORE_truncate64
79 #define __IGNORE_stat64
80 #define __IGNORE_lstat64
81 #define __IGNORE_fstat64
82 #define __IGNORE_fcntl64
83 #define __IGNORE_fadvise64_64
84 #define __IGNORE_fstatat64
85 #define __IGNORE_fstatfs64
86 #define __IGNORE_statfs64
87 #define __IGNORE_llseek
88 #define __IGNORE_mmap2
89 #define __IGNORE_clock_gettime64
90 #define __IGNORE_clock_settime64
91 #define __IGNORE_clock_adjtime64
92 #define __IGNORE_clock_getres_time64
93 #define __IGNORE_clock_nanosleep_time64
94 #define __IGNORE_timer_gettime64
95 #define __IGNORE_timer_settime64
96 #define __IGNORE_timerfd_gettime64
97 #define __IGNORE_timerfd_settime64
98 #define __IGNORE_utimensat_time64
99 #define __IGNORE_pselect6_time64
100 #define __IGNORE_ppoll_time64
101 #define __IGNORE_io_pgetevents_time64
102 #define __IGNORE_recvmmsg_time64
103 #define __IGNORE_mq_timedsend_time64
104 #define __IGNORE_mq_timedreceive_time64
105 #define __IGNORE_semtimedop_time64
106 #define __IGNORE_rt_sigtimedwait_time64
107 #define __IGNORE_futex_time64
108 #define __IGNORE_sched_rr_get_interval_time64
109 #else
110 #define __IGNORE_sendfile
111 #define __IGNORE_ftruncate
112 #define __IGNORE_truncate
113 #define __IGNORE_stat
114 #define __IGNORE_lstat
115 #define __IGNORE_fstat
116 #define __IGNORE_fcntl
117 #define __IGNORE_fadvise64
118 #define __IGNORE_newfstatat
119 #define __IGNORE_fstatfs
120 #define __IGNORE_statfs
121 #define __IGNORE_lseek
122 #define __IGNORE_mmap
123 #define __IGNORE_clock_gettime
124 #define __IGNORE_clock_settime
125 #define __IGNORE_clock_adjtime
126 #define __IGNORE_clock_getres
127 #define __IGNORE_clock_nanosleep
128 #define __IGNORE_timer_gettime
129 #define __IGNORE_timer_settime
130 #define __IGNORE_timerfd_gettime
131 #define __IGNORE_timerfd_settime
132 #define __IGNORE_utimensat
133 #define __IGNORE_pselect6
134 #define __IGNORE_ppoll
135 #define __IGNORE_io_pgetevents
136 #define __IGNORE_recvmmsg
137 #define __IGNORE_mq_timedsend
138 #define __IGNORE_mq_timedreceive
139 #define __IGNORE_semtimedop
140 #define __IGNORE_rt_sigtimedwait
141 #define __IGNORE_futex
142 #define __IGNORE_sched_rr_get_interval
143 #define __IGNORE_gettimeofday
144 #define __IGNORE_settimeofday
145 #define __IGNORE_wait4
146 #define __IGNORE_adjtimex
147 #define __IGNORE_nanosleep
148 #define __IGNORE_io_getevents
149 #define __IGNORE_recvmmsg
150 #endif
152 /* i386-specific or historical system calls */
153 #define __IGNORE_break
154 #define __IGNORE_stty
155 #define __IGNORE_gtty
156 #define __IGNORE_ftime
157 #define __IGNORE_prof
158 #define __IGNORE_lock
159 #define __IGNORE_mpx
160 #define __IGNORE_ulimit
161 #define __IGNORE_profil
162 #define __IGNORE_ioperm
163 #define __IGNORE_iopl
164 #define __IGNORE_idle
165 #define __IGNORE_modify_ldt
166 #define __IGNORE_ugetrlimit
167 #define __IGNORE_vm86
168 #define __IGNORE_vm86old
169 #define __IGNORE_set_thread_area
170 #define __IGNORE_get_thread_area
171 #define __IGNORE_madvise1
172 #define __IGNORE_oldstat
173 #define __IGNORE_oldfstat
174 #define __IGNORE_oldlstat
175 #define __IGNORE_oldolduname
176 #define __IGNORE_olduname
177 #define __IGNORE_umount
178 #define __IGNORE_waitpid
179 #define __IGNORE_stime
180 #define __IGNORE_nice
181 #define __IGNORE_signal
182 #define __IGNORE_sigaction
183 #define __IGNORE_sgetmask
184 #define __IGNORE_sigsuspend
185 #define __IGNORE_sigpending
186 #define __IGNORE_ssetmask
187 #define __IGNORE_readdir
188 #define __IGNORE_socketcall
189 #define __IGNORE_ipc
190 #define __IGNORE_sigreturn
191 #define __IGNORE_sigprocmask
192 #define __IGNORE_bdflush
193 #define __IGNORE__llseek
194 #define __IGNORE__newselect
195 #define __IGNORE_create_module
196 #define __IGNORE_query_module
197 #define __IGNORE_get_kernel_syms
198 #define __IGNORE_sysfs
199 #define __IGNORE_uselib
200 #define __IGNORE__sysctl
201 #define __IGNORE_arch_prctl
202 #define __IGNORE_nfsservctl
204 /* ... including the "new" 32-bit uid syscalls */
205 #define __IGNORE_lchown32
206 #define __IGNORE_getuid32
207 #define __IGNORE_getgid32
208 #define __IGNORE_geteuid32
209 #define __IGNORE_getegid32
210 #define __IGNORE_setreuid32
211 #define __IGNORE_setregid32
212 #define __IGNORE_getgroups32
213 #define __IGNORE_setgroups32
214 #define __IGNORE_fchown32
215 #define __IGNORE_setresuid32
216 #define __IGNORE_getresuid32
217 #define __IGNORE_setresgid32
218 #define __IGNORE_getresgid32
219 #define __IGNORE_chown32
220 #define __IGNORE_setuid32
221 #define __IGNORE_setgid32
222 #define __IGNORE_setfsuid32
223 #define __IGNORE_setfsgid32
225 /* these can be expressed using other calls */
226 #define __IGNORE_alarm /* setitimer */
227 #define __IGNORE_creat /* open */
228 #define __IGNORE_fork /* clone */
229 #define __IGNORE_futimesat /* utimensat */
230 #define __IGNORE_getpgrp /* getpgid */
231 #define __IGNORE_getdents /* getdents64 */
232 #define __IGNORE_pause /* sigsuspend */
233 #define __IGNORE_poll /* ppoll */
234 #define __IGNORE_select /* pselect6 */
235 #define __IGNORE_epoll_wait /* epoll_pwait */
236 #define __IGNORE_time /* gettimeofday */
237 #define __IGNORE_uname /* newuname */
238 #define __IGNORE_ustat /* statfs */
239 #define __IGNORE_utime /* utimes */
240 #define __IGNORE_vfork /* clone */
242 /* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
243 #ifdef __NR_sync_file_range2
244 #define __IGNORE_sync_file_range
245 #endif
247 /* Unmerged syscalls for AFS, STREAMS, etc. */
248 #define __IGNORE_afs_syscall
249 #define __IGNORE_getpmsg
250 #define __IGNORE_putpmsg
251 #define __IGNORE_vserver
255 syscall_list() {
256 grep '^[0-9]' "$1" | sort -n |
257 while read nr abi name entry ; do
258 echo "#if !defined(__NR_${name}) && !defined(__IGNORE_${name})"
259 echo "#warning syscall ${name} not implemented"
260 echo "#endif"
261 done
264 (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
265 $* -E -x c - > /dev/null