check-syscall-lists.sh 760 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. set -eo pipefail
  3. script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  4. cd "${script_path}/.."
  5. SYSCALLS_KERNEL="$(echo 'Kernel syscalls'; echo; grep -Eio '(?<=^ S\().*(?=\)( +\\)?$)' Kernel/API/Syscall.h | sort)"
  6. SYSCALLS_UE="$(echo 'Implemented in UserspaceEmulator'; echo; grep -Eio '(?<=^ case SC_).*(?=:$)' Userland/DevTools/UserspaceEmulator/Emulator.cpp | sort)"
  7. SYSCALLS_MAN2="$(echo 'Documented syscalls'; echo; find Base/usr/share/man/man2/ ! -type d -printf '%f\n' | sed -Ee 's,\.md,,' | sort)"
  8. set +e
  9. echo "ACTUAL versus UE"
  10. diff --color=always -u <(echo "${SYSCALLS_KERNEL}") <(echo "${SYSCALLS_UE}")
  11. echo
  12. echo "ACTUAL versus UE"
  13. diff --color=always -u <(echo "${SYSCALLS_KERNEL}") <(echo "${SYSCALLS_MAN2}")
  14. exit 0