summaryrefslogtreecommitdiff
path: root/Meta/check-syscall-lists.sh
blob: 95e954a0f2fa321a77a9af521d8992a3c6bb57a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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