diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-03-14 01:59:34 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-14 01:59:34 +0000 |
commit | 08915768a189082b7122de5605931911761d7a07 (patch) | |
tree | b90162bca6c4efcb37855eb5cf1e1d1949298f90 /pkg/sentry/kernel | |
parent | 36f9f649d73439d1ba92bb831246e05a967a01f6 (diff) | |
parent | 45a8ae240dd180f1b8b4c56e77ac67e4cd3af96f (diff) |
Merge release-20200219.0-176-g45a8ae2 (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/fd_table.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/kernel/fd_table.go b/pkg/sentry/kernel/fd_table.go index 00f914564..7de2e509e 100644 --- a/pkg/sentry/kernel/fd_table.go +++ b/pkg/sentry/kernel/fd_table.go @@ -191,7 +191,7 @@ func (f *FDTable) Size() int { return int(size) } -// forEach iterates over all non-nil files. +// forEach iterates over all non-nil files in sorted order. // // It is the caller's responsibility to acquire an appropriate lock. func (f *FDTable) forEach(fn func(fd int32, file *fs.File, fileVFS2 *vfs.FileDescription, flags FDFlags)) { @@ -458,7 +458,10 @@ func (f *FDTable) GetVFS2(fd int32) (*vfs.FileDescription, FDFlags) { } } -// GetFDs returns a list of valid fds. +// GetFDs returns a sorted list of valid fds. +// +// Precondition: The caller must be running on the task goroutine, or Task.mu +// must be locked. func (f *FDTable) GetFDs() []int32 { fds := make([]int32, 0, int(atomic.LoadInt32(&f.used))) f.forEach(func(fd int32, _ *fs.File, _ *vfs.FileDescription, _ FDFlags) { |