aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/std/syscall.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-05 04:48:05 +0900
committerOphestra <cat@gensokyo.uk>2025-11-05 04:48:05 +0900
commitbecaf8b6d7151971907ff65f338afa038f021c92 (patch)
tree4130439807baa92b11d85ad1199d0f2f5e27f001 /container/std/syscall.go
parent54c0d6bf48fdfade3aaf7741ec3d3cbc302c8b82 (diff)
std: relocate seccomp lookup tables
This should enable resolving NativeRule in hst. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/std/syscall.go')
-rw-r--r--container/std/syscall.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/container/std/syscall.go b/container/std/syscall.go
new file mode 100644
index 00000000..ff8d396e
--- /dev/null
+++ b/container/std/syscall.go
@@ -0,0 +1,28 @@
+package std
+
+import "iter"
+
+// Syscalls returns an iterator over all wired syscalls.
+func Syscalls() iter.Seq2[string, int] {
+ return func(yield func(string, int) bool) {
+ for name, num := range syscallNum {
+ if !yield(name, num) {
+ return
+ }
+ }
+ for name, num := range syscallNumExtra {
+ if !yield(name, num) {
+ return
+ }
+ }
+ }
+}
+
+// SyscallResolveName resolves a syscall number from its string representation.
+func SyscallResolveName(name string) (num int, ok bool) {
+ if num, ok = syscallNum[name]; ok {
+ return
+ }
+ num, ok = syscallNumExtra[name]
+ return
+}