summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/usage/memory.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2021-06-23 17:00:58 -0700
committergVisor bot <gvisor-bot@google.com>2021-06-23 17:03:58 -0700
commit7e0c1d9f1eae5620d38a6434c27442a350828876 (patch)
tree568be5d163e968baf50b65ac86f8c4b49bc698a9 /pkg/sentry/usage/memory.go
parentdfa4b3b90861a61653d0bef8f144bb4e82d21d78 (diff)
Use memutil.MapFile for the memory accounting page.
PiperOrigin-RevId: 381145216
Diffstat (limited to 'pkg/sentry/usage/memory.go')
-rw-r--r--pkg/sentry/usage/memory.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/usage/memory.go b/pkg/sentry/usage/memory.go
index 581862ee2..e7073ec87 100644
--- a/pkg/sentry/usage/memory.go
+++ b/pkg/sentry/usage/memory.go
@@ -132,7 +132,7 @@ func Init() error {
// always be the case for a newly mapped page from /dev/shm. If we obtain
// the shared memory through some other means in the future, we may have to
// explicitly zero the page.
- mmap, err := unix.Mmap(int(file.Fd()), 0, int(RTMemoryStatsSize), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED)
+ mmap, err := memutil.MapFile(0, RTMemoryStatsSize, unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED, file.Fd(), 0)
if err != nil {
return fmt.Errorf("error mapping usage file: %v", err)
}