summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-01-23 13:23:34 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-23 16:47:09 +0100
commit88dcbacabd085eefcc541e632cb738e66605e253 (patch)
tree96143c2be2f430ffa4292f699def170e951e65b1
parenta7d5fbb8afd99fff8d073e21cf27bcccb440e768 (diff)
downloadserenity-88dcbacabd085eefcc541e632cb738e66605e253.zip
Meta: Check consistency of various syscall tables
-rwxr-xr-xMeta/check-syscall-lists.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/Meta/check-syscall-lists.sh b/Meta/check-syscall-lists.sh
new file mode 100755
index 0000000000..95e954a0f2
--- /dev/null
+++ b/Meta/check-syscall-lists.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -eo pipefail
+
+script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
+cd "${script_path}/.."
+
+SYSCALLS_KERNEL="$(echo 'Kernel syscalls'; echo; grep -Pio '(?<=^ S\().*(?=\)( +\\)?$)' Kernel/API/Syscall.h | sort)"
+SYSCALLS_UE="$(echo 'Implemented in UserspaceEmulator'; echo; grep -Pio '(?<=^ case SC_).*(?=:$)' Userland/DevTools/UserspaceEmulator/Emulator.cpp | sort)"
+SYSCALLS_MAN2="$(echo 'Documented syscalls'; echo; find Base/usr/share/man/man2/ ! -type d -printf '%f\n' | sed -Ee 's,\.md,,' | sort)"
+
+set +e
+
+echo "ACTUAL versus UE"
+diff --color=always -u <(echo "${SYSCALLS_KERNEL}") <(echo "${SYSCALLS_UE}")
+echo
+echo "ACTUAL versus UE"
+diff --color=always -u <(echo "${SYSCALLS_KERNEL}") <(echo "${SYSCALLS_MAN2}")
+
+exit 0