summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/flags.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-11-20 23:12:35 +0000
committergVisor bot <gvisor-bot@google.com>2019-11-20 23:12:35 +0000
commitbd17bba359ecf2749e18c98b354a2633d35f88ac (patch)
tree6fa4eb4e27ff058123d24decbd1f0ccac8d126b1 /pkg/sentry/fs/flags.go
parenta98f44c8726eeec97e8b1e43978dd40d04d0b705 (diff)
parent012102eefd2b145ddee774cba28e4fa889fadd49 (diff)
Merge release-20191114.0-16-g012102e (automated)
Diffstat (limited to 'pkg/sentry/fs/flags.go')
-rw-r--r--pkg/sentry/fs/flags.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sentry/fs/flags.go b/pkg/sentry/fs/flags.go
index 0fab876a9..4338ae1fa 100644
--- a/pkg/sentry/fs/flags.go
+++ b/pkg/sentry/fs/flags.go
@@ -64,6 +64,10 @@ type FileFlags struct {
// NonSeekable indicates that file.offset isn't used.
NonSeekable bool
+
+ // Truncate indicates that the file should be truncated before opened.
+ // This is only applicable if the file is regular.
+ Truncate bool
}
// SettableFileFlags is a subset of FileFlags above that can be changed
@@ -118,6 +122,9 @@ func (f FileFlags) ToLinux() (mask uint) {
if f.LargeFile {
mask |= linux.O_LARGEFILE
}
+ if f.Truncate {
+ mask |= linux.O_TRUNC
+ }
switch {
case f.Read && f.Write: