From e786829e8320497a062be1b3f78646bcf9375abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Paolacci?= Date: Sat, 29 Dec 2012 14:34:06 -0500 Subject: [PATCH] runtime: handle locked mmap failure on Linux Used to then die on a nil pointer situation. Most Linux standard setups are rather restrictive regarding the default amount of lockable memory. R=minux.ma, rsc CC=golang-dev https://golang.org/cl/6997049 --- src/pkg/runtime/mem_linux.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pkg/runtime/mem_linux.c b/src/pkg/runtime/mem_linux.c index b3e79cc412c..db1975f4ca8 100644 --- a/src/pkg/runtime/mem_linux.c +++ b/src/pkg/runtime/mem_linux.c @@ -10,6 +10,7 @@ enum { + EAGAIN = 11, ENOMEM = 12, _PAGE_SIZE = 4096, }; @@ -63,6 +64,10 @@ runtime·SysAlloc(uintptr n) runtime·printf("if you're running SELinux, enable execmem for this process.\n"); runtime·exit(2); } + if(p == (void*)EAGAIN) { + runtime·printf("runtime: mmap: too much locked memory (check 'ulimit -l').\n"); + runtime·exit(2); + } return nil; } return p;