From: Sébastien Paolacci Date: Sat, 29 Dec 2012 19:34:06 +0000 (-0500) Subject: runtime: handle locked mmap failure on Linux X-Git-Tag: go1.1rc2~1516 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e786829e8320497a062be1b3f78646bcf9375abc;p=gostls13.git 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 --- diff --git a/src/pkg/runtime/mem_linux.c b/src/pkg/runtime/mem_linux.c index b3e79cc412..db1975f4ca 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;