MCPcopy
hub / github.com/google/gvisor / FileDescription

Struct FileDescription

pkg/sentry/vfs/file_description.go:44–88  ·  view source on GitHub ↗

A FileDescription represents an open file description, which is the entity referred to by a file descriptor (POSIX.1-2017 3.258 "Open File Description"). FileDescriptions are reference-counted. Unless otherwise specified, all FileDescription methods require that a reference is held. FileDescriptio

Source from the content-addressed store, hash-verified

42//
43// +stateify savable
44type FileDescription struct {
45 FileDescriptionRefs
46
47 // creds is the credentials under which the FileDescription was opened. It is immutable.
48 creds *auth.Credentials
49
50 // flagsMu protects `statusFlags` and `asyncHandler` below.
51 flagsMu sync.Mutex `state:"nosave"`
52
53 // statusFlags contains status flags, "initialized by open(2) and possibly
54 // modified by fcntl()" - fcntl(2). statusFlags can be read using atomic
55 // memory operations when it does not need to be synchronized with an
56 // access to asyncHandler.
57 statusFlags atomicbitops.Uint32
58
59 // fmodeFlags contains FMODE_* flags that describe the file's open mode
60 // properties, analogous to Linux's struct file::f_mode. fmodeFlags is
61 // immutable after initialization and is used on hot paths, so it is
62 // accessed without locking.
63 fmodeFlags uint32
64
65 // asyncHandler handles O_ASYNC signal generation. It is set with the
66 // F_SETOWN or F_SETOWN_EX fcntls. For asyncHandler to be used, O_ASYNC must
67 // also be set by fcntl(2).
68 asyncHandler FileAsync
69
70 // epolls is the set of epollInterests registered for this FileDescription.
71 // epolls is protected by epollMu.
72 epollMu epollMutex `state:"nosave"`
73 epolls map[*epollInterest]struct{}
74
75 // vd is the filesystem location at which this FileDescription was opened.
76 // A reference is held on vd. vd is immutable.
77 vd VirtualDentry
78
79 // opts contains options passed to FileDescription.Init(). opts is
80 // immutable.
81 opts FileDescriptionOptions
82
83 usedLockBSD atomicbitops.Uint32
84
85 // impl is the FileDescriptionImpl associated with this Filesystem. impl is
86 // immutable. This should be the last field in FileDescription.
87 impl FileDescriptionImpl
88}
89
90// SetCreated marks this FileDescription as having been created by the
91// current open operation.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected