diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-16 06:22:25 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-16 06:22:25 +0000 |
commit | cbc7d6a202b7e47457b3aa3daa55ebc5c1fbdb72 (patch) | |
tree | 5db961cfe01e42b712f232bd9028df2e33859a31 /pkg/sentry/kernel | |
parent | fe3658df8a9fd634c22008533c45e7cb2a5866cc (diff) | |
parent | dcd532e2e416aa81ca9ac42dc153731855f91418 (diff) |
Merge release-20200907.0-56-gdcd532e2e (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/syscalls.go | 10 |
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] |