summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-09-16 06:22:25 +0000
committergVisor bot <gvisor-bot@google.com>2020-09-16 06:22:25 +0000
commitcbc7d6a202b7e47457b3aa3daa55ebc5c1fbdb72 (patch)
tree5db961cfe01e42b712f232bd9028df2e33859a31 /pkg/sentry/kernel
parentfe3658df8a9fd634c22008533c45e7cb2a5866cc (diff)
parentdcd532e2e416aa81ca9ac42dc153731855f91418 (diff)
Merge release-20200907.0-56-gdcd532e2e (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/syscalls.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/syscalls.go b/pkg/sentry/kernel/syscalls.go
index 413111faf..332bdb8e8 100644
--- a/pkg/sentry/kernel/syscalls.go
+++ b/pkg/sentry/kernel/syscalls.go
@@ -348,6 +348,16 @@ func (s *SyscallTable) LookupName(sysno uintptr) string {
return fmt.Sprintf("sys_%d", sysno) // Unlikely.
}
+// LookupNo looks up a syscall number by name.
+func (s *SyscallTable) LookupNo(name string) (uintptr, error) {
+ for i, syscall := range s.Table {
+ if syscall.Name == name {
+ return uintptr(i), nil
+ }
+ }
+ return 0, fmt.Errorf("syscall %q not found", name)
+}
+
// LookupEmulate looks up an emulation syscall number.
func (s *SyscallTable) LookupEmulate(addr usermem.Addr) (uintptr, bool) {
sysno, ok := s.Emulate[addr]