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

Method decommitFile

pkg/sentry/pgalloc/pgalloc.go:1117–1126  ·  view source on GitHub ↗
(fr memmap.FileRange)

Source from the content-addressed store, hash-verified

1115}
1116
1117func (f *MemoryFile) decommitFile(fr memmap.FileRange) error {
1118 // "After a successful call, subsequent reads from this range will
1119 // return zeroes. The FALLOC_FL_PUNCH_HOLE flag must be ORed with
1120 // FALLOC_FL_KEEP_SIZE in mode ..." - fallocate(2)
1121 return unix.Fallocate(
1122 int(f.file.Fd()),
1123 unix.FALLOC_FL_PUNCH_HOLE|unix.FALLOC_FL_KEEP_SIZE,
1124 int64(fr.Start),
1125 int64(fr.Length()))
1126}
1127
1128func (f *MemoryFile) manuallyZero(fr memmap.FileRange) {
1129 f.forEachMappingSlice(fr, func(bs []byte) {

Callers 3

SaveToMethod · 0.95
releaserDestroyLockedMethod · 0.95

Calls 1

LengthMethod · 0.45

Tested by

no test coverage detected