diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-04-05 04:05:28 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-05 04:05:28 +0000 |
commit | bb592be222823c7bba4f0b1cf9e59938aa7981d9 (patch) | |
tree | e32e7e82be052269fc20ba50c459b05cd0ff4d0f /pkg/sentry/vfs | |
parent | 078753e0fe85dbcc047aaa5607a2bbc209491672 (diff) | |
parent | 24bee1c1813a691072cff5bad7a528690a99eb5e (diff) |
Merge release-20200323.0-70-g24bee1c (automated)
Diffstat (limited to 'pkg/sentry/vfs')
-rwxr-xr-x | pkg/sentry/vfs/file_description.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/file_description.go b/pkg/sentry/vfs/file_description.go index 5df4bbf45..28e93a441 100755 --- a/pkg/sentry/vfs/file_description.go +++ b/pkg/sentry/vfs/file_description.go @@ -182,6 +182,12 @@ func (fd *FileDescription) DecRef() { } } +// Refs returns the current number of references. The returned count +// is inherently racy and is unsafe to use without external synchronization. +func (fd *FileDescription) Refs() int64 { + return atomic.LoadInt64(&fd.refs) +} + // Mount returns the mount on which fd was opened. It does not take a reference // on the returned Mount. func (fd *FileDescription) Mount() *Mount { |