Back to home page

LXR

 
 

    


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