sandbox/seccomp: implement syscall lookup

This uses the Go map and is verified against libseccomp.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-07-01 00:35:27 +09:00
parent 241dc964a6
commit e03d702d08
3 changed files with 39 additions and 5 deletions

View File

@@ -5,12 +5,16 @@ import (
)
func TestSyscallResolveName(t *testing.T) {
for name, want := range syscallNum {
for name, want := range Syscalls() {
t.Run(name, func(t *testing.T) {
if got := syscallResolveName(name); got != want {
t.Errorf("syscallResolveName(%q) = %d, want %d",
name, got, want)
}
if got, ok := SyscallResolveName(name); !ok || got != want {
t.Errorf("SyscallResolveName(%q) = %d, want %d",
name, got, want)
}
})
}
}