Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0
0003 #
0004 # Check if current architecture are missing any function calls compared
0005 # to i386.
0006 # i386 define a number of legacy system calls that are i386 specific
0007 # and listed below so they are ignored.
0008 #
0009 # Usage:
0010 # checksyscalls.sh gcc gcc-options
0011 #
0012 
0013 ignore_list() {
0014 cat << EOF
0015 #include <asm/types.h>
0016 #include <asm/unistd.h>
0017 
0018 /* *at */
0019 #define __IGNORE_open           /* openat */
0020 #define __IGNORE_link           /* linkat */
0021 #define __IGNORE_unlink         /* unlinkat */
0022 #define __IGNORE_mknod          /* mknodat */
0023 #define __IGNORE_chmod          /* fchmodat */
0024 #define __IGNORE_chown          /* fchownat */
0025 #define __IGNORE_mkdir          /* mkdirat */
0026 #define __IGNORE_rmdir          /* unlinkat */
0027 #define __IGNORE_lchown         /* fchownat */
0028 #define __IGNORE_access         /* faccessat */
0029 #define __IGNORE_rename         /* renameat2 */
0030 #define __IGNORE_readlink       /* readlinkat */
0031 #define __IGNORE_symlink        /* symlinkat */
0032 #define __IGNORE_utimes         /* futimesat */
0033 #define __IGNORE_stat           /* fstatat */
0034 #define __IGNORE_lstat          /* fstatat */
0035 #define __IGNORE_stat64         /* fstatat64 */
0036 #define __IGNORE_lstat64        /* fstatat64 */
0037 
0038 #ifndef __ARCH_WANT_SET_GET_RLIMIT
0039 #define __IGNORE_getrlimit      /* getrlimit */
0040 #define __IGNORE_setrlimit      /* setrlimit */
0041 #endif
0042 
0043 #ifndef __ARCH_WANT_MEMFD_SECRET
0044 #define __IGNORE_memfd_secret
0045 #endif
0046 
0047 /* Missing flags argument */
0048 #define __IGNORE_renameat       /* renameat2 */
0049 
0050 /* CLOEXEC flag */
0051 #define __IGNORE_pipe           /* pipe2 */
0052 #define __IGNORE_dup2           /* dup3 */
0053 #define __IGNORE_epoll_create   /* epoll_create1 */
0054 #define __IGNORE_inotify_init   /* inotify_init1 */
0055 #define __IGNORE_eventfd        /* eventfd2 */
0056 #define __IGNORE_signalfd       /* signalfd4 */
0057 
0058 /* MMU */
0059 #ifndef CONFIG_MMU
0060 #define __IGNORE_madvise
0061 #define __IGNORE_mbind
0062 #define __IGNORE_mincore
0063 #define __IGNORE_mlock
0064 #define __IGNORE_mlockall
0065 #define __IGNORE_munlock
0066 #define __IGNORE_munlockall
0067 #define __IGNORE_mprotect
0068 #define __IGNORE_msync
0069 #define __IGNORE_migrate_pages
0070 #define __IGNORE_move_pages
0071 #define __IGNORE_remap_file_pages
0072 #define __IGNORE_get_mempolicy
0073 #define __IGNORE_set_mempolicy
0074 #define __IGNORE_swapoff
0075 #define __IGNORE_swapon
0076 #endif
0077 
0078 /* System calls for 32-bit kernels only */
0079 #if BITS_PER_LONG == 64
0080 #define __IGNORE_sendfile64
0081 #define __IGNORE_ftruncate64
0082 #define __IGNORE_truncate64
0083 #define __IGNORE_stat64
0084 #define __IGNORE_lstat64
0085 #define __IGNORE_fcntl64
0086 #define __IGNORE_fadvise64_64
0087 #define __IGNORE_fstatfs64
0088 #define __IGNORE_statfs64
0089 #define __IGNORE_llseek
0090 #define __IGNORE_mmap2
0091 #define __IGNORE_clock_gettime64
0092 #define __IGNORE_clock_settime64
0093 #define __IGNORE_clock_adjtime64
0094 #define __IGNORE_clock_getres_time64
0095 #define __IGNORE_clock_nanosleep_time64
0096 #define __IGNORE_timer_gettime64
0097 #define __IGNORE_timer_settime64
0098 #define __IGNORE_timerfd_gettime64
0099 #define __IGNORE_timerfd_settime64
0100 #define __IGNORE_utimensat_time64
0101 #define __IGNORE_pselect6_time64
0102 #define __IGNORE_ppoll_time64
0103 #define __IGNORE_io_pgetevents_time64
0104 #define __IGNORE_recvmmsg_time64
0105 #define __IGNORE_mq_timedsend_time64
0106 #define __IGNORE_mq_timedreceive_time64
0107 #define __IGNORE_semtimedop_time64
0108 #define __IGNORE_rt_sigtimedwait_time64
0109 #define __IGNORE_futex_time64
0110 #define __IGNORE_sched_rr_get_interval_time64
0111 #else
0112 #define __IGNORE_sendfile
0113 #define __IGNORE_ftruncate
0114 #define __IGNORE_truncate
0115 #define __IGNORE_stat
0116 #define __IGNORE_lstat
0117 #define __IGNORE_fstat
0118 #define __IGNORE_fcntl
0119 #define __IGNORE_fadvise64
0120 #define __IGNORE_newfstatat
0121 #define __IGNORE_fstatfs
0122 #define __IGNORE_statfs
0123 #define __IGNORE_lseek
0124 #define __IGNORE_mmap
0125 #define __IGNORE_clock_gettime
0126 #define __IGNORE_clock_settime
0127 #define __IGNORE_clock_adjtime
0128 #define __IGNORE_clock_getres
0129 #define __IGNORE_clock_nanosleep
0130 #define __IGNORE_timer_gettime
0131 #define __IGNORE_timer_settime
0132 #define __IGNORE_timerfd_gettime
0133 #define __IGNORE_timerfd_settime
0134 #define __IGNORE_utimensat
0135 #define __IGNORE_pselect6
0136 #define __IGNORE_ppoll
0137 #define __IGNORE_io_pgetevents
0138 #define __IGNORE_recvmmsg
0139 #define __IGNORE_mq_timedsend
0140 #define __IGNORE_mq_timedreceive
0141 #define __IGNORE_semtimedop
0142 #define __IGNORE_rt_sigtimedwait
0143 #define __IGNORE_futex
0144 #define __IGNORE_sched_rr_get_interval
0145 #define __IGNORE_gettimeofday
0146 #define __IGNORE_settimeofday
0147 #define __IGNORE_wait4
0148 #define __IGNORE_adjtimex
0149 #define __IGNORE_nanosleep
0150 #define __IGNORE_io_getevents
0151 #define __IGNORE_recvmmsg
0152 #endif
0153 
0154 /* i386-specific or historical system calls */
0155 #define __IGNORE_break
0156 #define __IGNORE_stty
0157 #define __IGNORE_gtty
0158 #define __IGNORE_ftime
0159 #define __IGNORE_prof
0160 #define __IGNORE_lock
0161 #define __IGNORE_mpx
0162 #define __IGNORE_ulimit
0163 #define __IGNORE_profil
0164 #define __IGNORE_ioperm
0165 #define __IGNORE_iopl
0166 #define __IGNORE_idle
0167 #define __IGNORE_modify_ldt
0168 #define __IGNORE_ugetrlimit
0169 #define __IGNORE_vm86
0170 #define __IGNORE_vm86old
0171 #define __IGNORE_set_thread_area
0172 #define __IGNORE_get_thread_area
0173 #define __IGNORE_madvise1
0174 #define __IGNORE_oldstat
0175 #define __IGNORE_oldfstat
0176 #define __IGNORE_oldlstat
0177 #define __IGNORE_oldolduname
0178 #define __IGNORE_olduname
0179 #define __IGNORE_umount
0180 #define __IGNORE_waitpid
0181 #define __IGNORE_stime
0182 #define __IGNORE_nice
0183 #define __IGNORE_signal
0184 #define __IGNORE_sigaction
0185 #define __IGNORE_sgetmask
0186 #define __IGNORE_sigsuspend
0187 #define __IGNORE_sigpending
0188 #define __IGNORE_ssetmask
0189 #define __IGNORE_readdir
0190 #define __IGNORE_socketcall
0191 #define __IGNORE_ipc
0192 #define __IGNORE_sigreturn
0193 #define __IGNORE_sigprocmask
0194 #define __IGNORE_bdflush
0195 #define __IGNORE__llseek
0196 #define __IGNORE__newselect
0197 #define __IGNORE_create_module
0198 #define __IGNORE_query_module
0199 #define __IGNORE_get_kernel_syms
0200 #define __IGNORE_sysfs
0201 #define __IGNORE_uselib
0202 #define __IGNORE__sysctl
0203 #define __IGNORE_arch_prctl
0204 #define __IGNORE_nfsservctl
0205 
0206 /* ... including the "new" 32-bit uid syscalls */
0207 #define __IGNORE_lchown32
0208 #define __IGNORE_getuid32
0209 #define __IGNORE_getgid32
0210 #define __IGNORE_geteuid32
0211 #define __IGNORE_getegid32
0212 #define __IGNORE_setreuid32
0213 #define __IGNORE_setregid32
0214 #define __IGNORE_getgroups32
0215 #define __IGNORE_setgroups32
0216 #define __IGNORE_fchown32
0217 #define __IGNORE_setresuid32
0218 #define __IGNORE_getresuid32
0219 #define __IGNORE_setresgid32
0220 #define __IGNORE_getresgid32
0221 #define __IGNORE_chown32
0222 #define __IGNORE_setuid32
0223 #define __IGNORE_setgid32
0224 #define __IGNORE_setfsuid32
0225 #define __IGNORE_setfsgid32
0226 
0227 /* these can be expressed using other calls */
0228 #define __IGNORE_alarm          /* setitimer */
0229 #define __IGNORE_creat          /* open */
0230 #define __IGNORE_fork           /* clone */
0231 #define __IGNORE_futimesat      /* utimensat */
0232 #define __IGNORE_getpgrp        /* getpgid */
0233 #define __IGNORE_getdents       /* getdents64 */
0234 #define __IGNORE_pause          /* sigsuspend */
0235 #define __IGNORE_poll           /* ppoll */
0236 #define __IGNORE_select         /* pselect6 */
0237 #define __IGNORE_epoll_wait     /* epoll_pwait */
0238 #define __IGNORE_time           /* gettimeofday */
0239 #define __IGNORE_uname          /* newuname */
0240 #define __IGNORE_ustat          /* statfs */
0241 #define __IGNORE_utime          /* utimes */
0242 #define __IGNORE_vfork          /* clone */
0243 
0244 /* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
0245 #ifdef __NR_sync_file_range2
0246 #define __IGNORE_sync_file_range
0247 #endif
0248 
0249 /* Unmerged syscalls for AFS, STREAMS, etc. */
0250 #define __IGNORE_afs_syscall
0251 #define __IGNORE_getpmsg
0252 #define __IGNORE_putpmsg
0253 #define __IGNORE_vserver
0254 
0255 /* 64-bit ports never needed these, and new 32-bit ports can use statx */
0256 #define __IGNORE_fstat64
0257 #define __IGNORE_fstatat64
0258 EOF
0259 }
0260 
0261 syscall_list() {
0262     grep '^[0-9]' "$1" | sort -n |
0263         while read nr abi name entry ; do
0264                 echo "#if !defined(__NR_${name}) && !defined(__IGNORE_${name})"
0265                 echo "#warning syscall ${name} not implemented"
0266                 echo "#endif"
0267         done
0268 }
0269 
0270 (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
0271 $* -Wno-error -Wno-unused-macros -E -x c - > /dev/null