checksyscalls.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. # syscallchk gcc gcc-options
  10. #
  11. ignore_list() {
  12. cat << EOF
  13. #include <asm/types.h>
  14. #include <asm/unistd.h>
  15. /* System calls for 32-bit kernels only */
  16. #if BITS_PER_LONG == 64
  17. #define __IGNORE_sendfile64
  18. #define __IGNORE_ftruncate64
  19. #define __IGNORE_truncate64
  20. #define __IGNORE_stat64
  21. #define __IGNORE_lstat64
  22. #define __IGNORE_fstat64
  23. #define __IGNORE_fcntl64
  24. #define __IGNORE_fadvise64_64
  25. #define __IGNORE_fstatat64
  26. #define __IGNORE_fstatfs64
  27. #define __IGNORE_statfs64
  28. #endif
  29. /* i386-specific or historical system calls */
  30. #define __IGNORE_break
  31. #define __IGNORE_stty
  32. #define __IGNORE_gtty
  33. #define __IGNORE_ftime
  34. #define __IGNORE_prof
  35. #define __IGNORE_lock
  36. #define __IGNORE_mpx
  37. #define __IGNORE_ulimit
  38. #define __IGNORE_profil
  39. #define __IGNORE_ioperm
  40. #define __IGNORE_iopl
  41. #define __IGNORE_idle
  42. #define __IGNORE_modify_ldt
  43. #define __IGNORE_ugetrlimit
  44. #define __IGNORE_mmap2
  45. #define __IGNORE_vm86
  46. #define __IGNORE_vm86old
  47. #define __IGNORE_set_thread_area
  48. #define __IGNORE_get_thread_area
  49. #define __IGNORE_madvise1
  50. #define __IGNORE_oldstat
  51. #define __IGNORE_oldfstat
  52. #define __IGNORE_oldlstat
  53. #define __IGNORE_oldolduname
  54. #define __IGNORE_olduname
  55. #define __IGNORE_umount2
  56. #define __IGNORE_umount
  57. #define __IGNORE_waitpid
  58. #define __IGNORE_stime
  59. #define __IGNORE_nice
  60. #define __IGNORE_signal
  61. #define __IGNORE_sigaction
  62. #define __IGNORE_sgetmask
  63. #define __IGNORE_sigsuspend
  64. #define __IGNORE_sigpending
  65. #define __IGNORE_ssetmask
  66. #define __IGNORE_readdir
  67. #define __IGNORE_socketcall
  68. #define __IGNORE_ipc
  69. #define __IGNORE_sigreturn
  70. #define __IGNORE_sigprocmask
  71. #define __IGNORE_bdflush
  72. #define __IGNORE__llseek
  73. #define __IGNORE__newselect
  74. #define __IGNORE_create_module
  75. #define __IGNORE_delete_module
  76. #define __IGNORE_query_module
  77. #define __IGNORE_get_kernel_syms
  78. /* ... including the "new" 32-bit uid syscalls */
  79. #define __IGNORE_lchown32
  80. #define __IGNORE_getuid32
  81. #define __IGNORE_getgid32
  82. #define __IGNORE_geteuid32
  83. #define __IGNORE_getegid32
  84. #define __IGNORE_setreuid32
  85. #define __IGNORE_setregid32
  86. #define __IGNORE_getgroups32
  87. #define __IGNORE_setgroups32
  88. #define __IGNORE_fchown32
  89. #define __IGNORE_setresuid32
  90. #define __IGNORE_getresuid32
  91. #define __IGNORE_setresgid32
  92. #define __IGNORE_getresgid32
  93. #define __IGNORE_chown32
  94. #define __IGNORE_setuid32
  95. #define __IGNORE_setgid32
  96. #define __IGNORE_setfsuid32
  97. #define __IGNORE_setfsgid32
  98. /* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
  99. #ifdef __NR_sync_file_range2
  100. #define __IGNORE_sync_file_range
  101. #endif
  102. /* Unmerged syscalls for AFS, STREAMS, etc. */
  103. #define __IGNORE_afs_syscall
  104. #define __IGNORE_getpmsg
  105. #define __IGNORE_putpmsg
  106. #define __IGNORE_vserver
  107. EOF
  108. }
  109. syscall_list() {
  110. sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\
  111. \#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
  112. \#warning syscall \1 not implemented\
  113. \#endif/p }' $1
  114. }
  115. (ignore_list && syscall_list ${srctree}/include/asm-x86/unistd_32.h) | \
  116. $* -E -x c - > /dev/null