]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - scripts/checksyscalls.sh
x86/msr-index: Cleanup bit defines
[mirror_ubuntu-bionic-kernel.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
68b77524
JH
41/* Missing flags argument */
42#define __IGNORE_renameat /* renameat2 */
43
e64a1617
AB
44/* CLOEXEC flag */
45#define __IGNORE_pipe /* pipe2 */
46#define __IGNORE_dup2 /* dup3 */
47#define __IGNORE_epoll_create /* epoll_create1 */
48#define __IGNORE_inotify_init /* inotify_init1 */
49#define __IGNORE_eventfd /* eventfd2 */
50#define __IGNORE_signalfd /* signalfd4 */
51
52/* MMU */
53#ifndef CONFIG_MMU
54#define __IGNORE_madvise
55#define __IGNORE_mbind
56#define __IGNORE_mincore
57#define __IGNORE_mlock
58#define __IGNORE_mlockall
59#define __IGNORE_munlock
60#define __IGNORE_munlockall
61#define __IGNORE_mprotect
62#define __IGNORE_msync
63#define __IGNORE_migrate_pages
64#define __IGNORE_move_pages
65#define __IGNORE_remap_file_pages
66#define __IGNORE_get_mempolicy
67#define __IGNORE_set_mempolicy
68#define __IGNORE_swapoff
69#define __IGNORE_swapon
70#endif
71
c53aeca0
SR
72/* System calls for 32-bit kernels only */
73#if BITS_PER_LONG == 64
74#define __IGNORE_sendfile64
75#define __IGNORE_ftruncate64
76#define __IGNORE_truncate64
77#define __IGNORE_stat64
78#define __IGNORE_lstat64
79#define __IGNORE_fstat64
80#define __IGNORE_fcntl64
81#define __IGNORE_fadvise64_64
82#define __IGNORE_fstatat64
83#define __IGNORE_fstatfs64
84#define __IGNORE_statfs64
e64a1617
AB
85#define __IGNORE_llseek
86#define __IGNORE_mmap2
87#else
88#define __IGNORE_sendfile
89#define __IGNORE_ftruncate
90#define __IGNORE_truncate
91#define __IGNORE_stat
92#define __IGNORE_lstat
93#define __IGNORE_fstat
94#define __IGNORE_fcntl
95#define __IGNORE_fadvise64
96#define __IGNORE_newfstatat
97#define __IGNORE_fstatfs
98#define __IGNORE_statfs
99#define __IGNORE_lseek
100#define __IGNORE_mmap
c53aeca0
SR
101#endif
102
103/* i386-specific or historical system calls */
104#define __IGNORE_break
105#define __IGNORE_stty
106#define __IGNORE_gtty
107#define __IGNORE_ftime
108#define __IGNORE_prof
109#define __IGNORE_lock
110#define __IGNORE_mpx
111#define __IGNORE_ulimit
112#define __IGNORE_profil
113#define __IGNORE_ioperm
114#define __IGNORE_iopl
115#define __IGNORE_idle
116#define __IGNORE_modify_ldt
117#define __IGNORE_ugetrlimit
c53aeca0
SR
118#define __IGNORE_vm86
119#define __IGNORE_vm86old
120#define __IGNORE_set_thread_area
121#define __IGNORE_get_thread_area
122#define __IGNORE_madvise1
123#define __IGNORE_oldstat
124#define __IGNORE_oldfstat
125#define __IGNORE_oldlstat
126#define __IGNORE_oldolduname
127#define __IGNORE_olduname
c53aeca0
SR
128#define __IGNORE_umount
129#define __IGNORE_waitpid
130#define __IGNORE_stime
131#define __IGNORE_nice
132#define __IGNORE_signal
133#define __IGNORE_sigaction
134#define __IGNORE_sgetmask
135#define __IGNORE_sigsuspend
136#define __IGNORE_sigpending
137#define __IGNORE_ssetmask
138#define __IGNORE_readdir
139#define __IGNORE_socketcall
140#define __IGNORE_ipc
141#define __IGNORE_sigreturn
142#define __IGNORE_sigprocmask
143#define __IGNORE_bdflush
144#define __IGNORE__llseek
145#define __IGNORE__newselect
146#define __IGNORE_create_module
c53aeca0
SR
147#define __IGNORE_query_module
148#define __IGNORE_get_kernel_syms
e64a1617
AB
149#define __IGNORE_sysfs
150#define __IGNORE_uselib
151#define __IGNORE__sysctl
f3e45597 152#define __IGNORE_arch_prctl
e64a1617 153
c53aeca0
SR
154/* ... including the "new" 32-bit uid syscalls */
155#define __IGNORE_lchown32
156#define __IGNORE_getuid32
157#define __IGNORE_getgid32
158#define __IGNORE_geteuid32
159#define __IGNORE_getegid32
160#define __IGNORE_setreuid32
161#define __IGNORE_setregid32
162#define __IGNORE_getgroups32
163#define __IGNORE_setgroups32
164#define __IGNORE_fchown32
165#define __IGNORE_setresuid32
166#define __IGNORE_getresuid32
167#define __IGNORE_setresgid32
168#define __IGNORE_getresgid32
169#define __IGNORE_chown32
170#define __IGNORE_setuid32
171#define __IGNORE_setgid32
172#define __IGNORE_setfsuid32
173#define __IGNORE_setfsgid32
174
e64a1617
AB
175/* these can be expressed using other calls */
176#define __IGNORE_alarm /* setitimer */
177#define __IGNORE_creat /* open */
178#define __IGNORE_fork /* clone */
179#define __IGNORE_futimesat /* utimensat */
180#define __IGNORE_getpgrp /* getpgid */
181#define __IGNORE_getdents /* getdents64 */
182#define __IGNORE_pause /* sigsuspend */
183#define __IGNORE_poll /* ppoll */
184#define __IGNORE_select /* pselect6 */
185#define __IGNORE_epoll_wait /* epoll_pwait */
186#define __IGNORE_time /* gettimeofday */
187#define __IGNORE_uname /* newuname */
188#define __IGNORE_ustat /* statfs */
189#define __IGNORE_utime /* utimes */
190#define __IGNORE_vfork /* clone */
e64a1617 191
edd5cd4a
DW
192/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
193#ifdef __NR_sync_file_range2
194#define __IGNORE_sync_file_range
195#endif
196
c53aeca0
SR
197/* Unmerged syscalls for AFS, STREAMS, etc. */
198#define __IGNORE_afs_syscall
199#define __IGNORE_getpmsg
200#define __IGNORE_putpmsg
201#define __IGNORE_vserver
202EOF
203}
204
205syscall_list() {
d21832e2 206 grep '^[0-9]' "$1" | sort -n |
29dc54c6 207 while read nr abi name entry ; do
d21832e2
AB
208 echo "#if !defined(__NR_${name}) && !defined(__IGNORE_${name})"
209 echo "#warning syscall ${name} not implemented"
210 echo "#endif"
29dc54c6 211 done
c53aeca0
SR
212}
213
1f57d5d8 214(ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
c53aeca0 215$* -E -x c - > /dev/null