From da20559137ccbf7f27e6008472f4d9159306df4a Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Tue, 18 Sep 2018 02:08:11 -0700 Subject: Provide better message when memfd_create fails with ENOSYS Updates #100 PiperOrigin-RevId: 213414821 Change-Id: I90c2e6c18c54a6afcd7ad6f409f670aa31577d37 --- pkg/sentry/usage/memory.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg/sentry/usage/memory.go') diff --git a/pkg/sentry/usage/memory.go b/pkg/sentry/usage/memory.go index f13a77779..92a478d85 100644 --- a/pkg/sentry/usage/memory.go +++ b/pkg/sentry/usage/memory.go @@ -122,6 +122,9 @@ func Init() error { const name = "memory-usage" fd, err := memutil.CreateMemFD(name, 0) if err != nil { + if e, ok := err.(syscall.Errno); ok && e == syscall.ENOSYS { + return fmt.Errorf("memfd_create(2) is not implemented. Check that you have Linux 3.17 or higher") + } return fmt.Errorf("error creating usage file: %v", err) } file := os.NewFile(uintptr(fd), name) -- cgit v1.2.3