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