Loading...
1#!/bin/sh
2#
3# Check if current architecture are missing any function calls compared
4# to i386.
5# i386 define a number of legacy system calls that are i386 specific
6# and listed below so they are ignored.
7#
8# Usage:
9# checksyscalls.sh gcc gcc-options
10#
11
12ignore_list() {
13cat << EOF
14#include <asm/types.h>
15#include <asm/unistd.h>
16
17/* *at */
18#define __IGNORE_open /* openat */
19#define __IGNORE_link /* linkat */
20#define __IGNORE_unlink /* unlinkat */
21#define __IGNORE_mknod /* mknodat */
22#define __IGNORE_chmod /* fchmodat */
23#define __IGNORE_chown /* fchownat */
24#define __IGNORE_mkdir /* mkdirat */
25#define __IGNORE_rmdir /* unlinkat */
26#define __IGNORE_lchown /* fchownat */
27#define __IGNORE_access /* faccessat */
28#define __IGNORE_rename /* renameat2 */
29#define __IGNORE_readlink /* readlinkat */
30#define __IGNORE_symlink /* symlinkat */
31#define __IGNORE_utimes /* futimesat */
32#if BITS_PER_LONG == 64
33#define __IGNORE_stat /* fstatat */
34#define __IGNORE_lstat /* fstatat */
35#else
36#define __IGNORE_stat64 /* fstatat64 */
37#define __IGNORE_lstat64 /* fstatat64 */
38#endif
39
40/* Missing flags argument */
41#define __IGNORE_renameat /* renameat2 */
42
43/* CLOEXEC flag */
44#define __IGNORE_pipe /* pipe2 */
45#define __IGNORE_dup2 /* dup3 */
46#define __IGNORE_epoll_create /* epoll_create1 */
47#define __IGNORE_inotify_init /* inotify_init1 */
48#define __IGNORE_eventfd /* eventfd2 */
49#define __IGNORE_signalfd /* signalfd4 */
50
51/* MMU */
52#ifndef CONFIG_MMU
53#define __IGNORE_madvise
54#define __IGNORE_mbind
55#define __IGNORE_mincore
56#define __IGNORE_mlock
57#define __IGNORE_mlockall
58#define __IGNORE_munlock
59#define __IGNORE_munlockall
60#define __IGNORE_mprotect
61#define __IGNORE_msync
62#define __IGNORE_migrate_pages
63#define __IGNORE_move_pages
64#define __IGNORE_remap_file_pages
65#define __IGNORE_get_mempolicy
66#define __IGNORE_set_mempolicy
67#define __IGNORE_swapoff
68#define __IGNORE_swapon
69#endif
70
71/* System calls for 32-bit kernels only */
72#if BITS_PER_LONG == 64
73#define __IGNORE_sendfile64
74#define __IGNORE_ftruncate64
75#define __IGNORE_truncate64
76#define __IGNORE_stat64
77#define __IGNORE_lstat64
78#define __IGNORE_fstat64
79#define __IGNORE_fcntl64
80#define __IGNORE_fadvise64_64
81#define __IGNORE_fstatat64
82#define __IGNORE_fstatfs64
83#define __IGNORE_statfs64
84#define __IGNORE_llseek
85#define __IGNORE_mmap2
86#else
87#define __IGNORE_sendfile
88#define __IGNORE_ftruncate
89#define __IGNORE_truncate
90#define __IGNORE_stat
91#define __IGNORE_lstat
92#define __IGNORE_fstat
93#define __IGNORE_fcntl
94#define __IGNORE_fadvise64
95#define __IGNORE_newfstatat
96#define __IGNORE_fstatfs
97#define __IGNORE_statfs
98#define __IGNORE_lseek
99#define __IGNORE_mmap
100#endif
101
102/* i386-specific or historical system calls */
103#define __IGNORE_break
104#define __IGNORE_stty
105#define __IGNORE_gtty
106#define __IGNORE_ftime
107#define __IGNORE_prof
108#define __IGNORE_lock
109#define __IGNORE_mpx
110#define __IGNORE_ulimit
111#define __IGNORE_profil
112#define __IGNORE_ioperm
113#define __IGNORE_iopl
114#define __IGNORE_idle
115#define __IGNORE_modify_ldt
116#define __IGNORE_ugetrlimit
117#define __IGNORE_vm86
118#define __IGNORE_vm86old
119#define __IGNORE_set_thread_area
120#define __IGNORE_get_thread_area
121#define __IGNORE_madvise1
122#define __IGNORE_oldstat
123#define __IGNORE_oldfstat
124#define __IGNORE_oldlstat
125#define __IGNORE_oldolduname
126#define __IGNORE_olduname
127#define __IGNORE_umount
128#define __IGNORE_waitpid
129#define __IGNORE_stime
130#define __IGNORE_nice
131#define __IGNORE_signal
132#define __IGNORE_sigaction
133#define __IGNORE_sgetmask
134#define __IGNORE_sigsuspend
135#define __IGNORE_sigpending
136#define __IGNORE_ssetmask
137#define __IGNORE_readdir
138#define __IGNORE_socketcall
139#define __IGNORE_ipc
140#define __IGNORE_sigreturn
141#define __IGNORE_sigprocmask
142#define __IGNORE_bdflush
143#define __IGNORE__llseek
144#define __IGNORE__newselect
145#define __IGNORE_create_module
146#define __IGNORE_query_module
147#define __IGNORE_get_kernel_syms
148#define __IGNORE_sysfs
149#define __IGNORE_uselib
150#define __IGNORE__sysctl
151
152/* ... including the "new" 32-bit uid syscalls */
153#define __IGNORE_lchown32
154#define __IGNORE_getuid32
155#define __IGNORE_getgid32
156#define __IGNORE_geteuid32
157#define __IGNORE_getegid32
158#define __IGNORE_setreuid32
159#define __IGNORE_setregid32
160#define __IGNORE_getgroups32
161#define __IGNORE_setgroups32
162#define __IGNORE_fchown32
163#define __IGNORE_setresuid32
164#define __IGNORE_getresuid32
165#define __IGNORE_setresgid32
166#define __IGNORE_getresgid32
167#define __IGNORE_chown32
168#define __IGNORE_setuid32
169#define __IGNORE_setgid32
170#define __IGNORE_setfsuid32
171#define __IGNORE_setfsgid32
172
173/* these can be expressed using other calls */
174#define __IGNORE_alarm /* setitimer */
175#define __IGNORE_creat /* open */
176#define __IGNORE_fork /* clone */
177#define __IGNORE_futimesat /* utimensat */
178#define __IGNORE_getpgrp /* getpgid */
179#define __IGNORE_getdents /* getdents64 */
180#define __IGNORE_pause /* sigsuspend */
181#define __IGNORE_poll /* ppoll */
182#define __IGNORE_select /* pselect6 */
183#define __IGNORE_epoll_wait /* epoll_pwait */
184#define __IGNORE_time /* gettimeofday */
185#define __IGNORE_uname /* newuname */
186#define __IGNORE_ustat /* statfs */
187#define __IGNORE_utime /* utimes */
188#define __IGNORE_vfork /* clone */
189
190/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
191#ifdef __NR_sync_file_range2
192#define __IGNORE_sync_file_range
193#endif
194
195/* Unmerged syscalls for AFS, STREAMS, etc. */
196#define __IGNORE_afs_syscall
197#define __IGNORE_getpmsg
198#define __IGNORE_putpmsg
199#define __IGNORE_vserver
200EOF
201}
202
203syscall_list() {
204 grep '^[0-9]' "$1" | sort -n | (
205 while read nr abi name entry ; do
206 cat <<EOF
207#if !defined(__NR_${name}) && !defined(__IGNORE_${name})
208#warning syscall ${name} not implemented
209#endif
210EOF
211 done
212 )
213}
214
215(ignore_list && syscall_list $(dirname $0)/../arch/x86/syscalls/syscall_32.tbl) | \
216$* -E -x c - > /dev/null
1#!/bin/sh
2#
3# Check if current architecture are missing any function calls compared
4# to i386.
5# i386 define a number of legacy system calls that are i386 specific
6# and listed below so they are ignored.
7#
8# Usage:
9# checksyscalls.sh gcc gcc-options
10#
11
12ignore_list() {
13cat << EOF
14#include <asm/types.h>
15#include <asm/unistd.h>
16
17/* *at */
18#define __IGNORE_open /* openat */
19#define __IGNORE_link /* linkat */
20#define __IGNORE_unlink /* unlinkat */
21#define __IGNORE_mknod /* mknodat */
22#define __IGNORE_chmod /* fchmodat */
23#define __IGNORE_chown /* fchownat */
24#define __IGNORE_mkdir /* mkdirat */
25#define __IGNORE_rmdir /* unlinkat */
26#define __IGNORE_lchown /* fchownat */
27#define __IGNORE_access /* faccessat */
28#define __IGNORE_rename /* renameat */
29#define __IGNORE_readlink /* readlinkat */
30#define __IGNORE_symlink /* symlinkat */
31#define __IGNORE_utimes /* futimesat */
32#if BITS_PER_LONG == 64
33#define __IGNORE_stat /* fstatat */
34#define __IGNORE_lstat /* fstatat */
35#else
36#define __IGNORE_stat64 /* fstatat64 */
37#define __IGNORE_lstat64 /* fstatat64 */
38#endif
39
40/* CLOEXEC flag */
41#define __IGNORE_pipe /* pipe2 */
42#define __IGNORE_dup2 /* dup3 */
43#define __IGNORE_epoll_create /* epoll_create1 */
44#define __IGNORE_inotify_init /* inotify_init1 */
45#define __IGNORE_eventfd /* eventfd2 */
46#define __IGNORE_signalfd /* signalfd4 */
47
48/* MMU */
49#ifndef CONFIG_MMU
50#define __IGNORE_madvise
51#define __IGNORE_mbind
52#define __IGNORE_mincore
53#define __IGNORE_mlock
54#define __IGNORE_mlockall
55#define __IGNORE_munlock
56#define __IGNORE_munlockall
57#define __IGNORE_mprotect
58#define __IGNORE_msync
59#define __IGNORE_migrate_pages
60#define __IGNORE_move_pages
61#define __IGNORE_remap_file_pages
62#define __IGNORE_get_mempolicy
63#define __IGNORE_set_mempolicy
64#define __IGNORE_swapoff
65#define __IGNORE_swapon
66#endif
67
68/* System calls for 32-bit kernels only */
69#if BITS_PER_LONG == 64
70#define __IGNORE_sendfile64
71#define __IGNORE_ftruncate64
72#define __IGNORE_truncate64
73#define __IGNORE_stat64
74#define __IGNORE_lstat64
75#define __IGNORE_fstat64
76#define __IGNORE_fcntl64
77#define __IGNORE_fadvise64_64
78#define __IGNORE_fstatat64
79#define __IGNORE_fstatfs64
80#define __IGNORE_statfs64
81#define __IGNORE_llseek
82#define __IGNORE_mmap2
83#else
84#define __IGNORE_sendfile
85#define __IGNORE_ftruncate
86#define __IGNORE_truncate
87#define __IGNORE_stat
88#define __IGNORE_lstat
89#define __IGNORE_fstat
90#define __IGNORE_fcntl
91#define __IGNORE_fadvise64
92#define __IGNORE_newfstatat
93#define __IGNORE_fstatfs
94#define __IGNORE_statfs
95#define __IGNORE_lseek
96#define __IGNORE_mmap
97#endif
98
99/* i386-specific or historical system calls */
100#define __IGNORE_break
101#define __IGNORE_stty
102#define __IGNORE_gtty
103#define __IGNORE_ftime
104#define __IGNORE_prof
105#define __IGNORE_lock
106#define __IGNORE_mpx
107#define __IGNORE_ulimit
108#define __IGNORE_profil
109#define __IGNORE_ioperm
110#define __IGNORE_iopl
111#define __IGNORE_idle
112#define __IGNORE_modify_ldt
113#define __IGNORE_ugetrlimit
114#define __IGNORE_vm86
115#define __IGNORE_vm86old
116#define __IGNORE_set_thread_area
117#define __IGNORE_get_thread_area
118#define __IGNORE_madvise1
119#define __IGNORE_oldstat
120#define __IGNORE_oldfstat
121#define __IGNORE_oldlstat
122#define __IGNORE_oldolduname
123#define __IGNORE_olduname
124#define __IGNORE_umount
125#define __IGNORE_waitpid
126#define __IGNORE_stime
127#define __IGNORE_nice
128#define __IGNORE_signal
129#define __IGNORE_sigaction
130#define __IGNORE_sgetmask
131#define __IGNORE_sigsuspend
132#define __IGNORE_sigpending
133#define __IGNORE_ssetmask
134#define __IGNORE_readdir
135#define __IGNORE_socketcall
136#define __IGNORE_ipc
137#define __IGNORE_sigreturn
138#define __IGNORE_sigprocmask
139#define __IGNORE_bdflush
140#define __IGNORE__llseek
141#define __IGNORE__newselect
142#define __IGNORE_create_module
143#define __IGNORE_query_module
144#define __IGNORE_get_kernel_syms
145#define __IGNORE_sysfs
146#define __IGNORE_uselib
147#define __IGNORE__sysctl
148
149/* ... including the "new" 32-bit uid syscalls */
150#define __IGNORE_lchown32
151#define __IGNORE_getuid32
152#define __IGNORE_getgid32
153#define __IGNORE_geteuid32
154#define __IGNORE_getegid32
155#define __IGNORE_setreuid32
156#define __IGNORE_setregid32
157#define __IGNORE_getgroups32
158#define __IGNORE_setgroups32
159#define __IGNORE_fchown32
160#define __IGNORE_setresuid32
161#define __IGNORE_getresuid32
162#define __IGNORE_setresgid32
163#define __IGNORE_getresgid32
164#define __IGNORE_chown32
165#define __IGNORE_setuid32
166#define __IGNORE_setgid32
167#define __IGNORE_setfsuid32
168#define __IGNORE_setfsgid32
169
170/* these can be expressed using other calls */
171#define __IGNORE_alarm /* setitimer */
172#define __IGNORE_creat /* open */
173#define __IGNORE_fork /* clone */
174#define __IGNORE_futimesat /* utimensat */
175#define __IGNORE_getpgrp /* getpgid */
176#define __IGNORE_getdents /* getdents64 */
177#define __IGNORE_pause /* sigsuspend */
178#define __IGNORE_poll /* ppoll */
179#define __IGNORE_select /* pselect6 */
180#define __IGNORE_epoll_wait /* epoll_pwait */
181#define __IGNORE_time /* gettimeofday */
182#define __IGNORE_uname /* newuname */
183#define __IGNORE_ustat /* statfs */
184#define __IGNORE_utime /* utimes */
185#define __IGNORE_vfork /* clone */
186
187/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
188#ifdef __NR_sync_file_range2
189#define __IGNORE_sync_file_range
190#endif
191
192/* Unmerged syscalls for AFS, STREAMS, etc. */
193#define __IGNORE_afs_syscall
194#define __IGNORE_getpmsg
195#define __IGNORE_putpmsg
196#define __IGNORE_vserver
197EOF
198}
199
200syscall_list() {
201sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\
202\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
203\#warning syscall \1 not implemented\
204\#endif/p' $1
205}
206
207(ignore_list && syscall_list $(dirname $0)/../arch/x86/include/asm/unistd_32.h) | \
208$* -E -x c - > /dev/null