aboutsummaryrefslogtreecommitdiffhomepage
path: root/seccomp/syscall.go
diff options
context:
space:
mode:
Diffstat (limited to 'seccomp/syscall.go')
-rw-r--r--seccomp/syscall.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/seccomp/syscall.go b/seccomp/syscall.go
new file mode 100644
index 00000000..36a988aa
--- /dev/null
+++ b/seccomp/syscall.go
@@ -0,0 +1,28 @@
+package seccomp
+
+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
+}