diff options
author | Jing Chen <chjing@google.com> | 2020-12-11 04:19:58 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-12-11 04:22:04 -0800 |
commit | 73eccab91ec58aafd1ffdf038993b78a812ba30f (patch) | |
tree | 67d1a83d0c35fd264c2e2ce64466bc220959303a /pkg/sentry/syscalls | |
parent | 0eb4acad37c448a298c77090b3475ce6903ecf18 (diff) |
Make semctl IPC_INFO cmd return the index of highest used entry.
PiperOrigin-RevId: 346973338
Diffstat (limited to 'pkg/sentry/syscalls')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_sem.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_sem.go b/pkg/sentry/syscalls/linux/sys_sem.go index a1601676f..a62a6b3b5 100644 --- a/pkg/sentry/syscalls/linux/sys_sem.go +++ b/pkg/sentry/syscalls/linux/sys_sem.go @@ -150,9 +150,10 @@ func Semctl(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal buf := args[3].Pointer() r := t.IPCNamespace().SemaphoreRegistry() info := r.IPCInfo() - _, err := info.CopyOut(t, buf) - // TODO(gvisor.dev/issue/137): Return the index of the highest used entry. - return 0, nil, err + if _, err := info.CopyOut(t, buf); err != nil { + return 0, nil, err + } + return uintptr(r.HighestIndex()), nil, nil case linux.SEM_INFO, linux.SEM_STAT, |