aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/seccomp/syscall.go
blob: 36a988aad6f3c5a8bd020f9a3f57904199be87db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
}